Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 1.1 KB

copy_a_file_from_your_container_to_the_host.md

File metadata and controls

39 lines (26 loc) · 1.1 KB

Copy a file from your container to the host operating system

It is possible to copy files from your Docker container onto your host operating system, this is quite useful for cpanfile.snapshot files etc. generated inside the container.

$ docker cp <containerId>:/file/path/within/container /host/path/target

Example:

$ docker cp myapp:/usr/src/app/cpanfile.snapshot ./cpanfile.snapshot

Alternatively you can use the name, both can be optained using docker ps or something like ctop:

$ docker ps --format "{{.Names}}"

The other way around:

$ docker cp /host/path/target <containerId>:/file/path/within/container

Example:

$ docker cp myapp.conf myapp:/usr/src/app/myapp.conf

You can get the name of the container

References