Docker Managing containers Copying file from/to containers

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

from container to host

docker cp CONTAINER_NAME:PATH_IN_CONTAINER PATH_IN_HOST

from host to container

docker cp PATH_IN_HOST CONTAINER_NAME:PATH_IN_CONTAINER

If I use jess/transmission from

https://hub.docker.com/r/jess/transmission/builds/bsn7eqxrkzrhxazcuytbmzp/

, the files in the container are in /transmission/download

and my current directory on the host is /home/$USER/abc, after

docker cp transmission_id_or_name:/transmission/download .

I will have the files copied to

/home/$USER/abc/transmission/download

you can not, using docker cp copy only one file, you copy the directory tree and the files



Got any Docker Question?