mirror of
https://github.com/containers/podman.git
synced 2025-12-12 09:50:25 +08:00
podman copy files to the volume with a container
enabls podman to cpoy files between the host machine and the volume related with a container. Close #3059 Signed-off-by: Qi Wang <qiwan@redhat.com>
This commit is contained in:
@@ -184,4 +184,25 @@ var _ = Describe("Podman cp", func() {
|
||||
_, err = os.Stat("/tmp/cp_test.txt")
|
||||
Expect(err).To(Not(BeNil()))
|
||||
})
|
||||
It("podman cp volume", func() {
|
||||
session := podmanTest.Podman([]string{"volume", "create", "data"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "-v", "data:/data", "--name", "container1", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
err = ioutil.WriteFile("cp_vol", []byte("copy to the volume"), 0644)
|
||||
if err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
session = podmanTest.Podman([]string{"cp", "cp_vol", "container1" + ":/data/cp_vol1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"cp", "container1" + ":/data/cp_vol1", "cp_vol2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user