Copying files from Docker container to host

后端 未结 18 2386
小蘑菇
小蘑菇 2020-11-22 13:39

I\'m thinking of using Docker to build my dependencies on a Continuous Integration (CI) server, so that I don\'t have to install all the runtimes and libraries on the agents

18条回答
  •  耶瑟儿~
    2020-11-22 14:16

    I am posting this for anyone that is using Docker for Mac. This is what worked for me:

     $ mkdir mybackup # local directory on Mac
    
     $ docker run --rm --volumes-from  \
        -v `pwd`/mybackup:/backup \  
        busybox \                   
        cp /data/mydata.txt /backup 
    

    Note that when I mount using -v that backup directory is automatically created.

    I hope this is useful to someone someday. :)

提交回复
热议问题