other versions
- jessie-backports 1.6.2~dfsg1-1~bpo8+1
- testing 18.09.1+dfsg1-5+b10
- unstable 18.09.1+dfsg1-5+b10
- experimental 18.09.3+dfsg1-1
DOCKER(1) | JUNE 2014 | DOCKER(1) |
NAME¶
docker-cp - Copy files or folders from a container's PATH to a HOSTDIR or to STDOUT.SYNOPSIS¶
docker cp [ --help] CONTAINER:PATH HOSTDIR|-DESCRIPTION¶
Copy files or folders from a CONTAINER:PATH to the HOSTDIR or to STDOUT. The CONTAINER:PATH is relative to the root of the container's filesystem. You can copy from either a running or stopped container. The PATH can be a file or directory. The docker cp command assumes all PATH values start at the / (root) directory. This means supplying the initial forward slash is optional; The command sees compassionate_darwin:/tmp/foo/myfile.txt and compassionate_darwin:tmp/foo/myfile.txt as identical. The HOSTDIR refers to a directory on the host. If you do not specify an absolute path for your HOSTDIR value, Docker creates the directory relative to where you run the docker cp command. For example, suppose you want to copy the /tmp/foo directory from a container to the /tmp directory on your host. If you run docker cp in your (home) directory on the host:$ docker cp compassionate_darwin:tmp/foo /tmp
$ docker cp compassionate_darwin:tmp/foo tmp
$ docker cp sharp_ptolemy:/tmp/foo/myfile.txt /tmp
$ docker cp sharp_ptolemy:/tmp/foo/secondfile.txt /tmp
$ ls /tmp/foo myfile.txt secondfile.txt
OPTIONS¶
--helpPrint usage statement
EXAMPLES¶
An important shell script file, created in a bash shell, is copied from the exited container to the current dir on the host:# docker cp c071f3c3ee81:setup.sh .
HISTORY¶
April 2014, Originally compiled by William Henry (whenry at redhat dot com) based on docker.com source material and internal work. June 2014, updated by Sven Dowideit ⟨SvenDowideit@home.org.au⟩Docker User Manuals | Docker Community |