Pārlūkot izejas kodu

Set default values for uid and gid to prevent errors when starting a service.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
Daniel Nephin 8 gadi atpakaļ
vecāks
revīzija
167b3f95b7
1 mainītis faili ar 11 papildinājumiem un 2 dzēšanām
  1. 11 2
      cli/compose/convert/service.go

+ 11 - 2
cli/compose/convert/service.go

@@ -196,11 +196,20 @@ func convertServiceSecrets(
 			source = secretSpec.External.Name
 		}
 
+		uid := secret.UID
+		gid := secret.GID
+		if uid == "" {
+			uid = "0"
+		}
+		if gid == "" {
+			gid = "0"
+		}
+
 		opts = append(opts, &types.SecretRequestOption{
 			Source: source,
 			Target: target,
-			UID:    secret.UID,
-			GID:    secret.GID,
+			UID:    uid,
+			GID:    gid,
 			Mode:   os.FileMode(secret.Mode),
 		})
 	}