How to copy files from host to Docker container?

前端 未结 30 2473
南方客
南方客 2020-11-22 06:58

I am trying to build a backup and restore solution for the Docker containers that we work with.

I have Docker base image that I have created, ubuntu:base

30条回答
  •  北海茫月
    2020-11-22 07:30

    If the host is CentOS or Fedora, there is a proxy NOT in /var/lib/docker/aufs, but it is under /proc:

    cp -r /home/user/mydata/* /proc/$(docker inspect --format "{{.State.Pid}}" )/root
    

    This cmd will copy all contents of data directory to / of container with id "containerid".

提交回复
热议问题