How to copy files from host to Docker container?

前端 未结 30 3036
南方客
南方客 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:37

    The solution is given below,

    From the Docker shell,

    root@123abc:/root#  <-- get the container ID
    

    From the host

    cp thefile.txt /var/lib/docker/devicemapper/mnt/123abc/rootfs/root
    

    The file shall be directly copied to the location where the container sits on the filesystem.

提交回复
热议问题