Skip to content

Commit

Permalink
Merge pull request #1045 from YaoZengzeng/entrypoint
Browse files Browse the repository at this point in the history
bugfix: distinguish cmd and entrypoint better
  • Loading branch information
HusterWan authored Apr 4, 2018
2 parents eb8484d + 861cc1d commit 55fbc1a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions daemon/mgr/container_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,14 @@ func (meta *ContainerMeta) merge(getconfig func() (v1.ImageConfig, error)) error
return err
}

// If user specify the Entrypoint, no need to merge image's configuration.
// Otherwise use the image's configuration to fill it.
if len(meta.Config.Entrypoint) == 0 {
if len(meta.Config.Cmd) == 0 {
meta.Config.Cmd = config.Cmd
}
meta.Config.Entrypoint = config.Entrypoint
}
if len(meta.Config.Cmd) == 0 {
meta.Config.Cmd = config.Cmd
}
if meta.Config.Env == nil {
meta.Config.Env = config.Env
} else {
Expand Down
3 changes: 2 additions & 1 deletion daemon/mgr/cri.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ func (c *CriManager) CreateContainer(ctx context.Context, r *runtime.CreateConta
}
createConfig := &apitypes.ContainerCreateConfig{
ContainerConfig: apitypes.ContainerConfig{
Cmd: append(config.Command, config.Args...),
Entrypoint: config.Command,
Cmd: config.Args,
Env: generateEnvList(config.GetEnvs()),
Image: image,
WorkingDir: config.WorkingDir,
Expand Down

0 comments on commit 55fbc1a

Please sign in to comment.