summaryrefslogtreecommitdiff
path: root/cmd/podman/common/specgen.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2020-08-07 13:57:02 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-08-10 10:18:43 -0400
commit39c493b3fcc8c1c5203e4511d7ff3250d11de285 (patch)
tree45ed6af9c423757e65237a10ddb311d9325d4014 /cmd/podman/common/specgen.go
parentda00482ef29e0a04a690f1538391e38b0b951dd0 (diff)
downloadpodman-39c493b3fcc8c1c5203e4511d7ff3250d11de285.tar.gz
podman-39c493b3fcc8c1c5203e4511d7ff3250d11de285.tar.bz2
podman-39c493b3fcc8c1c5203e4511d7ff3250d11de285.zip
Do not use image CMD if user gave ENTRYPOINT
This matches Docker behavior, and seems to make sense - the CMD may have been specific to the original entrypoint and probably does not make sense if it was changed. While we're in here, greatly simplify the logic for populating the SpecGen's Command. We create the full command when making the OCI spec, so the client should not be doing any more than setting it to the Command the user passed in, and completely ignoring ENTRYPOINT. Fixes #7115 Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'cmd/podman/common/specgen.go')
-rw-r--r--cmd/podman/common/specgen.go18
1 files changed, 1 insertions, 17 deletions
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go
index 0b6897d3a..5c6c47e8d 100644
--- a/cmd/podman/common/specgen.go
+++ b/cmd/podman/common/specgen.go
@@ -387,8 +387,6 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
s.Annotations = annotations
s.WorkDir = c.Workdir
- userCommand := []string{}
- var command []string
if c.Entrypoint != nil {
entrypoint := []string{}
if ep := *c.Entrypoint; len(ep) > 0 {
@@ -398,27 +396,13 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string
}
}
s.Entrypoint = entrypoint
- // Build the command
- // If we have an entry point, it goes first
- command = entrypoint
}
// Include the command used to create the container.
s.ContainerCreateCommand = os.Args
if len(inputCommand) > 0 {
- // User command overrides data CMD
- command = append(command, inputCommand...)
- userCommand = append(userCommand, inputCommand...)
- }
-
- switch {
- case len(inputCommand) > 0:
- s.Command = userCommand
- case c.Entrypoint != nil:
- s.Command = []string{}
- default:
- s.Command = command
+ s.Command = inputCommand
}
// SHM Size