The following example demonstrates how to copy files from the host to a container. All commands are run on the host.
- Get the container Short Name (output truncated):
[root@hostname]# docker ps -a CONTAINER ID bd1ea8d5526c
- Discover the container Long Name:
[root@hostname]# docker inspect -f '{{.Id}}' bd1ea8d5526c bd1ea8d5526c55df4740de9ba5afe14ed28ac3d127901ccb1653e187962c5156
The container long name can also be discovered using the container name in place of the container identifier.
- Copy a file to root file system (/tmp) on the container:
[root@hostname]# cp myfile.txt /var/lib/docker/devicemapper/mnt/bd1ea8d5526c55df4740de9ba5afe14ed28ac3d127901ccb1653e187962c5156/rootfs/tmp/myfile.txt