mirror of
https://github.com/containers/podman.git
synced 2025-07-09 22:14:22 +08:00
Add --include-volumes flag to 'podman commit'
The 'docker commit' will never include a container's volumes when committing, without an explicit request through '--change'. Podman, however, defaulted to including user volumes as image volumes. Make this behavior depend on a new flag, '--include-volumes', and make the default behavior match Docker. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
cmd/podman
docs
libpod
test/e2e
@ -131,7 +131,7 @@ var _ = Describe("Podman commit", func() {
|
||||
Expect(check.ExitCode()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman commit with volume mounts", func() {
|
||||
It("podman commit with volumes mounts and no include-volumes", func() {
|
||||
s := podmanTest.Podman([]string{"run", "--name", "test1", "-v", "/tmp:/foo", "alpine", "date"})
|
||||
s.WaitWithDefaultTimeout()
|
||||
Expect(s.ExitCode()).To(Equal(0))
|
||||
@ -140,6 +140,23 @@ var _ = Describe("Podman commit", func() {
|
||||
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].Config.Volumes["/foo"]
|
||||
Expect(ok).To(BeFalse())
|
||||
})
|
||||
|
||||
It("podman commit with volume mounts and --include-volumes", 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", "--include-volumes", "test1", "newimage"})
|
||||
c.WaitWithDefaultTimeout()
|
||||
Expect(c.ExitCode()).To(Equal(0))
|
||||
|
||||
inspect := podmanTest.Podman([]string{"inspect", "newimage"})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect.ExitCode()).To(Equal(0))
|
||||
|
Reference in New Issue
Block a user