Low Orbit Flux Logo 2 D

Docker How To Copy File From Container To Host

You may have been expecting this to be a bit of a pain but it turns out that it is really easy to copy files from a container to a host.

This will copy a file from my-container1 to the local system:


sudo docker cp my-container1:/data1/output.csv /home/user1/mydir

In the above example you the container is named my-container1. The file inside the container is “/data1/output.csv”. It will be copied to the directory /home/user1/mydir on your local system. You can modify these as needed.

You might also want to check out our guide Docker How To Access File System.