Copying files between docker containers

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

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

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

–Siju

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

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

2 Likes