From fa6ba6802618e3e23746c4b4707fb403a55514ae Mon Sep 17 00:00:00 2001 From: zhangguanzhang Date: Sat, 22 Aug 2020 18:15:53 +0800 Subject: fix apiv2 will create containers with incorrect commands Signed-off-by: zhangguanzhang --- libpod/container_internal.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libpod') diff --git a/libpod/container_internal.go b/libpod/container_internal.go index f3f11f945..c41d81a2b 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -483,12 +483,13 @@ func (c *Container) setupStorage(ctx context.Context) error { // Set the default Entrypoint and Command if containerInfo.Config != nil { + // Set CMD in the container to the default configuration only if ENTRYPOINT is not set by the user. + if c.config.Entrypoint == nil && c.config.Command == nil { + c.config.Command = containerInfo.Config.Config.Cmd + } if c.config.Entrypoint == nil { c.config.Entrypoint = containerInfo.Config.Config.Entrypoint } - if c.config.Command == nil { - c.config.Command = containerInfo.Config.Config.Cmd - } } artifacts := filepath.Join(c.config.StaticDir, artifactsDir) -- cgit v1.2.3-54-g00ecf