summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-26 13:04:37 -0400
committerGitHub <noreply@github.com>2020-08-26 13:04:37 -0400
commitf99954c7ca4428e501676fa47a63b5cecadd9454 (patch)
tree2e62d26620f7feca4b98d63b56c88fd27d322124 /libpod
parent3a9d5248ac65358e7a4f123c2cdbe93584084d6a (diff)
parentfa6ba6802618e3e23746c4b4707fb403a55514ae (diff)
downloadpodman-f99954c7ca4428e501676fa47a63b5cecadd9454.tar.gz
podman-f99954c7ca4428e501676fa47a63b5cecadd9454.tar.bz2
podman-f99954c7ca4428e501676fa47a63b5cecadd9454.zip
Merge pull request #7409 from zhangguanzhang/apiv2-create-ctr-with-invalid-entrypoint
fix apiv2 will create containers with incorrect commands
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go7
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)