docker copy folder code example

Example 1: copy files from a docker container to the host machine using cmd

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

Example 2: copy file from docker container to host

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

Example 3: copy docker image from one machine to another

docker save -o <path for generated tar file> <image name>

Example 4: docker copy folder to container

docker cp Desktop/imagesets <container id>:tf_files/flower_photos/imagesets