diff options
author | zhangguanzhang <zhangguanzhang@qq.com> | 2020-08-22 18:15:53 +0800 |
---|---|---|
committer | zhangguanzhang <zhangguanzhang@qq.com> | 2020-08-24 23:07:30 +0800 |
commit | fa6ba6802618e3e23746c4b4707fb403a55514ae (patch) | |
tree | 807e78f11803170afec2b27963398218ce1df4d0 /libpod | |
parent | 4828455055010a1376f1e83832bfa34787f3a1e7 (diff) | |
download | podman-fa6ba6802618e3e23746c4b4707fb403a55514ae.tar.gz podman-fa6ba6802618e3e23746c4b4707fb403a55514ae.tar.bz2 podman-fa6ba6802618e3e23746c4b4707fb403a55514ae.zip |
fix apiv2 will create containers with incorrect commands
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_internal.go | 7 |
1 files changed, 4 insertions, 3 deletions
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) |