do not commit default volumes from container

when performing a container commit, we should not add the default list of volumes
for a container to the resulting image.  it will cause the resulting image to crash
when run subsequently.

Signed-off-by: baude <bbaude@redhat.com>

Closes: #699
Approved by: mheon
This commit is contained in:
baude
2018-04-30 08:26:31 -05:00
committed by Atomic Bot
parent c8c39779a7
commit 9924956dc8
3 changed files with 47 additions and 8 deletions

View File

@ -110,4 +110,26 @@ var _ = Describe("Podman commit", func() {
check.WaitWithDefaultTimeout()
Expect(check.ExitCode()).To(Equal(0))
})
It("podman commit with volume mounts", func() {
s := podmanTest.Podman([]string{"run", "--name", "test1", "-v", "/tmp:/foo", "alpine", "date"})
s.WaitWithDefaultTimeout()
Expect(s.ExitCode()).To(Equal(0))
c := podmanTest.Podman([]string{"commit", "test1", "newimage"})
c.WaitWithDefaultTimeout()
Expect(c.ExitCode()).To(Equal(0))
inspect := podmanTest.Podman([]string{"inspect", "newimage"})
inspect.WaitWithDefaultTimeout()
Expect(inspect.ExitCode()).To(Equal(0))
image := inspect.InspectImageJSON()
_, ok := image[0].ContainerConfig.Volumes["/tmp"]
Expect(ok).To(BeTrue())
r := podmanTest.Podman([]string{"run", "newimage"})
r.WaitWithDefaultTimeout()
Expect(r.ExitCode()).To(Equal(0))
})
})