til

Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as a developer

View project on GitHub

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 in the container

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

Example:

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

Or 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

References