diff --git a/cli/compose/convert/service.go b/cli/compose/convert/service.go index 4a5489562c..882050560e 100644 --- a/cli/compose/convert/service.go +++ b/cli/compose/convert/service.go @@ -219,19 +219,27 @@ func convertServiceSecrets( if gid == "" { gid = "0" } + mode := secret.Mode + if mode == nil { + mode = uint32Ptr(0444) + } opts = append(opts, &types.SecretRequestOption{ Source: source, Target: target, UID: uid, GID: gid, - Mode: os.FileMode(secret.Mode), + Mode: os.FileMode(*mode), }) } return servicecli.ParseSecrets(client, opts) } +func uint32Ptr(value uint32) *uint32 { + return &value +} + func convertExtraHosts(extraHosts map[string]string) []string { hosts := []string{} for host, ip := range extraHosts { diff --git a/cli/compose/types/types.go b/cli/compose/types/types.go index cae7b4af26..d1371d2a1c 100644 --- a/cli/compose/types/types.go +++ b/cli/compose/types/types.go @@ -199,7 +199,7 @@ type ServiceSecretConfig struct { Target string UID string GID string - Mode uint32 + Mode *uint32 } // UlimitsConfig the ulimit configuration