Docker Copying file from host to container

后端 未结 2 1113
情深已故
情深已故 2021-01-18 05:41

I am trying to copy a set of files from docker host to container. On a AUFS system directly going into /var/lib/docker/aufs/... works. However I am another system with Fedor

2条回答
  •  长发绾君心
    2021-01-18 06:15

    UPDATE: Now docker cp command line command works both ways. See the docker cp documentation

    Usage

    docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-

    docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH

    =======Original Answer ==============

    Found the most easiest way that works across storage drivers:

    cd /proc/`docker inspect --format "{{.State.Pid}}" `/root
    

    Have tested this on Fedora with Devicemapper as the storage driver and on Ubuntu with AUFS as the storage driver. Works for me in both the cases.

提交回复
热议问题