Implementation details
CONTAINER:PATH -> HOSTPATH
To copy files or folders from a container to the host we have a native `docker cp` command available since the Docker 1.0.

For example, if we have a container named kickass_yonathand wish to copy /home/data.txtfrom this container to the host’s current directory, it can be done the following way:
$ docker cp kickass_yonath:/home/data.txt .
HOSTPATH -> CONTAINER:PATH
To copy files from the host to a container one can use the `docker exec` command available since Docker 1.3.0.

If have a test.txt file and wish to copy it to /home/e1/e2 inkickass_yonath container, first of all, we create a directory structure in the container with mkdir:
$ docker exec -i kickass_yonath sh -c ‘mkdir -p /home/e1/e2'
Next, copy the file by redirecting input and output:
$ docker exec -i kickass_yonath sh -c 'cat > /home/e1/e2/test.txt' < ./test.txt
When executed, the file is transferred from the current directory to the container.
CONTAINER1:PATH CONTAINER2:PATH

This use-case can be implemented by combining the both cases we listed above and using the host as the intermediate storage.
First of all, copy file to some temporary directory on the host:
$ docker cp kickass_yonath:/home/e1/e2/test.txt /tmp/tmp.pGlwFknjlF
Next, transfer it from the temp directory to the other container:
$ docker exec -i ecstatic_colden sh -c ‘cat > /home/test.txt’ < /tmp/tmp.pGlwFknjlF/test.txt
The same technique can be used to copy directories of any .