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}}"
$ 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