diff options
-rw-r--r-- | cmd/podman/create.go | 4 | ||||
-rw-r--r-- | test/e2e/run_entrypoint_test.go | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go index 2012aa6de..5e2ea3969 100644 --- a/cmd/podman/create.go +++ b/cmd/podman/create.go @@ -587,6 +587,10 @@ func parseCreateOpts(c *cli.Context, runtime *libpod.Runtime, imageName string, command = append(command, data.ContainerConfig.Cmd...) } + if len(command) == 0 { + return nil, errors.Errorf("No command specified on command line or as CMD or ENTRYPOINT in this image") + } + // EXPOSED PORTS portBindings, err := exposedPorts(c, data.ContainerConfig.ExposedPorts) if err != nil { diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go index 2ae282967..e06f8bb3a 100644 --- a/test/e2e/run_entrypoint_test.go +++ b/test/e2e/run_entrypoint_test.go @@ -28,6 +28,17 @@ var _ = Describe("Podman run entrypoint", func() { }) + It("podman run no command, entrypoint, or cmd", func() { + dockerfile := `FROM docker.io/library/alpine:latest +ENTRYPOINT [] +CMD [] +` + podmanTest.BuildImage(dockerfile, "foobar.com/entrypoint:latest") + session := podmanTest.Podman([]string{"run", "foobar.com/entrypoint:latest"}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(Equal(125)) + }) + It("podman run entrypoint", func() { dockerfile := `FROM docker.io/library/alpine:latest ENTRYPOINT ["grep", "Alpine", "/etc/os-release"] |