diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-17 09:55:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-17 09:55:32 -0500 |
commit | 2e522ff29cfea06a37debfc4a31a231bf7097b34 (patch) | |
tree | 14dcb028e71b9a33ba84944bfa842badc552f68a | |
parent | aa7c7bde7918ee830551299c0bf2196ec00b18ec (diff) | |
parent | 12a577aea55bc5967913da6306d819065c0cfb76 (diff) | |
download | podman-2e522ff29cfea06a37debfc4a31a231bf7097b34.tar.gz podman-2e522ff29cfea06a37debfc4a31a231bf7097b34.tar.bz2 podman-2e522ff29cfea06a37debfc4a31a231bf7097b34.zip |
Merge pull request #9404 from rhatdan/entrypoint
Ignore entrypoint=[""]
-rw-r--r-- | pkg/specgen/generate/oci.go | 5 | ||||
-rw-r--r-- | test/e2e/run_entrypoint_test.go | 12 |
2 files changed, 16 insertions, 1 deletions
diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go index 1a0ec08a5..eefe45dfe 100644 --- a/pkg/specgen/generate/oci.go +++ b/pkg/specgen/generate/oci.go @@ -105,7 +105,10 @@ func makeCommand(ctx context.Context, s *specgen.SpecGenerator, img *image.Image entrypoint = newEntry } - finalCommand = append(finalCommand, entrypoint...) + // Don't append the entrypoint if it is [""] + if len(entrypoint) != 1 || entrypoint[0] != "" { + finalCommand = append(finalCommand, entrypoint...) + } // Only use image command if the user did not manually set an // entrypoint. diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go index cac3d759d..389f142b1 100644 --- a/test/e2e/run_entrypoint_test.go +++ b/test/e2e/run_entrypoint_test.go @@ -43,6 +43,18 @@ CMD [] Expect(session.ExitCode()).To(Equal(125)) }) + It("podman run entrypoint == [\"\"]", func() { + dockerfile := `FROM quay.io/libpod/alpine:latest +ENTRYPOINT [""] +CMD [] +` + podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest", "false") + session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest", "echo", "hello"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(0)) + Expect(session.OutputToString()).To(Equal("hello")) + }) + It("podman run entrypoint", func() { dockerfile := `FROM quay.io/libpod/alpine:latest ENTRYPOINT ["grep", "Alpine", "/etc/os-release"] |