How to copy files from host to Docker container?

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

    There are good answers, but too specific. I find out docker ps is good way to get container id you're interested in. Then do

    mount | grep 
    

    to see where the volume is mounted. That's

    /var/lib/docker/devicemapper/mnt//rootfs/
    

    for me, but it might be a different path depending on the OS and configuration. Now simply copy files to that path.

    Using -v is not always practical.

提交回复
热议问题