fix oci.WithImageConfigArgs for windows

Signed-off-by: Andrey Kolomentsev <andrey.kolomentsev@docker.com>
This commit is contained in:
akolomentsev 2018-12-17 17:49:42 -08:00
parent 48bebbb6e0
commit da9471fb11

View File

@ -310,7 +310,7 @@ func WithImageConfigArgs(image Image, args []string) SpecOpts {
setProcess(s) setProcess(s)
if s.Linux != nil { if s.Linux != nil {
s.Process.Env = append(s.Process.Env, config.Env...) s.Process.Env = replaceOrAppendEnvValues(s.Process.Env, config.Env)
cmd := config.Cmd cmd := config.Cmd
if len(args) > 0 { if len(args) > 0 {
cmd = args cmd = args
@ -332,8 +332,14 @@ func WithImageConfigArgs(image Image, args []string) SpecOpts {
// even if there is no specified user in the image config // even if there is no specified user in the image config
return WithAdditionalGIDs("root")(ctx, client, c, s) return WithAdditionalGIDs("root")(ctx, client, c, s)
} else if s.Windows != nil { } else if s.Windows != nil {
s.Process.Env = config.Env s.Process.Env = replaceOrAppendEnvValues(s.Process.Env, config.Env)
s.Process.Args = append(config.Entrypoint, config.Cmd...) cmd := config.Cmd
if len(args) > 0 {
cmd = args
}
s.Process.Args = append(config.Entrypoint, cmd...)
s.Process.Cwd = config.WorkingDir
s.Process.User = specs.User{ s.Process.User = specs.User{
Username: config.User, Username: config.User,
} }