mirror of
https://github.com/containers/podman.git
synced 2025-06-21 17:38:12 +08:00
Merge pull request #6587 from rhatdan/workdir
Do not default WorkingDir to / on client side
This commit is contained in:
@ -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 {
|
||||
|
@ -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"})
|
||||
|
Reference in New Issue
Block a user