Docker Community Forums

Share and learn in the Docker community.

Copying files between docker containers


(Vaibhavgupta0702) #1

How can a file be copied from one docker container to another docker container directly ?


(Siju Oommen George) #2

To copy file1 from /tmp of container1 to /tmp of container2

$ sudo docker cp container1:/tmp/file1 container2:/tmp

–Siju


(Vaibhavgupta0702) #4

This method does not seems to work
It says “Copying between containers is not supported”


(Sam) #5

use the --volumes-from option on the docker run to IMPORT volumes that were defined in another running container.

then those volumes appear as folders (linux) in the new container process…

once that is done, then you can just cp -R source_path dest_path like always