Copy files to docker container from host

The docker cp command is used to copy files to/from the docker container and host system. See the following example: Change CONTAINER_ID with the read id of a running container. The above command will copy the data.txt file from the host machine to the docker container under the /var/files directory.

Copy files from docker container to host

The following command will copy /var/files/data.txt file from the docker container to the host machine.