shell - Docker Copying file from host to container -
i trying copy set of files docker host container. on aufs system directly going /var/lib/docker/aufs/... works. system fedora has devicemapper storage driver. on system if this:
[root@myhost tmp]# docker inspect -f '{{.id}}' 393ef4b9f485 393ef4b9f485dafc78037f59bdbeda16d63b8338487248ed25b68cf544f29e24 [root@myhost tmp]# cd /var/lib/docker/devicemapper/mnt/393ef4b9f485dafc78037f59bdbeda16d63b8338487248ed25b68cf544f29e24 [root@myhost 393ef4b9f485dafc78037f59bdbeda16d63b8338487248ed25b68cf544f29e24]# ls -l total 0 [root@myhost 393ef4b9f485dafc78037f59bdbeda16d63b8338487248ed25b68cf544f29e24]#
i nothing. have tried suggestions copying files host docker container
using tar seems great, instead of directly going underlying fs. cannot assume tar present in containers.
if relevant, have tried create file in container, , did find . -name in /var/lib/docker/devicemapper/mnt no avail.
any hints?
edit 1: based on 1 of answers, adding these constraints. intent copy files container without a. not modify containers build (dockerfile), b. not install ssh or ftp daemons. , c. not change way container started.
edit 2: adding docker info :
# docker info containers: 1 images: 21 storage driver: devicemapper pool name: docker-253:0-397467-pool pool blocksize: 65.54 kb backing filesystem: extfs data file: metadata file: data space used: 4.261 gb data space total: 107.4 gb data space available: 103.1 gb metadata space used: 3.596 mb metadata space total: 2.147 gb metadata space available: 2.144 gb udev sync supported: true library version: 1.02.90 (2014-09-01) execution driver: native-0.2 kernel version: 3.17.4-301.fc21.x86_64 operating system: fedora 21 (twenty one) cpus: 4 total memory: 3.86 gib name: fedora-docker
docker version 1.6.0 , container image based on rhel.
update: docker cp command line command works both ways. see docker cp documentation
usage
docker cp [options] container:src_path dest_path|-
docker cp [options] src_path|- container:dest_path
=======original answer ==============
found easiest way works across storage drivers:
cd /proc/`docker inspect --format "{{.state.pid}}" <containerid>`/root
have tested on fedora devicemapper storage driver , on ubuntu aufs storage driver. works me in both cases.
Comments
Post a Comment