diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-06-12 11:26:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 11:26:01 -0400 |
commit | 3f026eb6a682a68e69f9376b72157a8f084e575c (patch) | |
tree | cdd8503582bb5c515c81ffb41a8c867825946f04 | |
parent | 92dafdcab8e8dd28b931ca26513c12bb878ce95c (diff) | |
parent | 2386a2ef2dd3ab4976a3e1dd6d76616e8558d85b (diff) | |
download | podman-3f026eb6a682a68e69f9376b72157a8f084e575c.tar.gz podman-3f026eb6a682a68e69f9376b72157a8f084e575c.tar.bz2 podman-3f026eb6a682a68e69f9376b72157a8f084e575c.zip |
Merge pull request #6587 from rhatdan/workdir
Do not default WorkingDir to / on client side
-rw-r--r-- | cmd/podman/common/specgen.go | 6 | ||||
-rw-r--r-- | test/e2e/images_test.go | 11 |
2 files changed, 12 insertions, 5 deletions
diff --git a/cmd/podman/common/specgen.go b/cmd/podman/common/specgen.go index fee9d8c7b..2a5ebea3c 100644 --- a/cmd/podman/common/specgen.go +++ b/cmd/podman/common/specgen.go @@ -385,11 +385,7 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *ContainerCLIOpts, args []string } s.Annotations = annotations - workDir := "/" - if wd := c.Workdir; len(wd) > 0 { - workDir = wd - } - s.WorkDir = workDir + s.WorkDir = c.Workdir entrypoint := []string{} userCommand := []string{} if c.Entrypoint != nil { diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go index b16cff411..0ee7260c2 100644 --- a/test/e2e/images_test.go +++ b/test/e2e/images_test.go @@ -186,6 +186,17 @@ RUN apk update && apk add strace Expect(len(result.OutputToStringArray()) >= 1).To(BeTrue()) }) + It("podman images workingdir from image", func() { + dockerfile := `FROM docker.io/library/alpine:latest +WORKDIR /test +` + podmanTest.BuildImage(dockerfile, "foobar.com/workdir:latest", "false") + result := podmanTest.Podman([]string{"run", "foobar.com/workdir:latest", "pwd"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + Expect(result.OutputToString()).To(Equal("/test")) + }) + It("podman images filter after image", func() { podmanTest.RestoreAllArtifacts() rmi := podmanTest.PodmanNoCache([]string{"rmi", "busybox"}) |