From 865769d911254a0f2f650322825391f5b31413a2 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 16 Feb 2021 17:03:32 -0500 Subject: Ignore entrypoint=[\"\"] We recieved an issue with an image that was built with entrypoint=[""] This blows up on Podman, but works on Docker. When we setup the OCI Runtime, we should drop entrypoint if it is == [""] https://github.com/containers/podman/issues/9377 Signed-off-by: Daniel J Walsh --- pkg/specgen/generate/oci.go | 5 ++++- test/e2e/run_entrypoint_test.go | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go index e62131244..d1d2f552e 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"] -- cgit v1.2.3-54-g00ecf