Skip to content

Commit

Permalink
Ignore entrypoint=[\"\"]
Browse files Browse the repository at this point in the history
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 == [""]

containers#9377

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Feb 17, 2021
1 parent 5004212 commit 12a577a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/specgen/generate/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 12 additions & 0 deletions test/e2e/run_entrypoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 12a577a

Please sign in to comment.