diff options
author | Matthew Heon <mheon@redhat.com> | 2020-08-07 13:57:02 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-08-10 10:18:43 -0400 |
commit | 39c493b3fcc8c1c5203e4511d7ff3250d11de285 (patch) | |
tree | 45ed6af9c423757e65237a10ddb311d9325d4014 /pkg/specgen/generate/oci.go | |
parent | da00482ef29e0a04a690f1538391e38b0b951dd0 (diff) | |
download | podman-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 'pkg/specgen/generate/oci.go')
-rw-r--r-- | pkg/specgen/generate/oci.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go index 78cd32253..ee9f63680 100644 --- a/pkg/specgen/generate/oci.go +++ b/pkg/specgen/generate/oci.go @@ -96,8 +96,10 @@ func makeCommand(ctx context.Context, s *specgen.SpecGenerator, img *image.Image finalCommand = append(finalCommand, entrypoint...) + // Only use image command if the user did not manually set an + // entrypoint. command := s.Command - if command == nil && img != nil { + if command == nil && img != nil && s.Entrypoint == nil { newCmd, err := img.Cmd(ctx) if err != nil { return nil, err |