libpod: fix lookup for subpath in volumes

a subdirectory that is below a mount destination is detected as a
subpath.

Closes: https://github.com/containers/podman/issues/15789

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2022-09-14 13:01:43 +02:00
parent 92dc61d5ed
commit 14e5d1c15d
3 changed files with 59 additions and 4 deletions

View File

@ -46,6 +46,15 @@ var _ = Describe("Podman run", func() {
Expect(session).Should(Exit(126))
})
It("podman run a container using a --workdir under a bind mount", func() {
volume, err := CreateTempDirInTempDir()
Expect(err).To(BeNil())
session := podmanTest.Podman([]string{"run", "--volume", fmt.Sprintf("%s:/var_ovl/:O", volume), "--workdir", "/var_ovl/log", ALPINE, "true"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
})
It("podman run a container on an image with a workdir", func() {
dockerfile := fmt.Sprintf(`FROM %s
RUN mkdir -p /home/foobar /etc/foobar; chown bin:bin /etc/foobar