How to copy files from host to Docker container?

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

    I just started using docker to compile VLC, here's what you can do to copy files back and forth from containers:

    su -
    cd /var/lib/docker
    ls -palR > /home/user/dockerfilelist.txt
    

    Search for a familiar file in that txt and you'll have the folder, cd to it as root and voila! copy all you want.

    There might be a path with "merged" in it, I guess you want the one with "diff" in it.

    Also if you exit the container and want to be back where you left off:

    docker ps -a
    docker start -i containerid
    

    I guess that's usefull when you didn't name anything with a command like

    docker run -it registry.videolan.org:5000/vlc-debian-win64 /bin/bash
    

    Sure the hacker method but so what!

提交回复
热议问题