How to copy files from host to Docker container?

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

    docker cp SRC_PATH CONTAINER_ID:DEST_PATH
    

    For example, I want to copy my file xxxx/download/jenkins to tomcat

    I start to get the id of the container Tomcat

    docker ps
    
    CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS                    NAMES
    63686740b488        tomcat              "catalina.sh run"   12 seconds ago      Up 11 seconds       0.0.0.0:8080->8080/tcp   peaceful_babbage
    
    docker cp xxxx/download/jenkins.war  63686740b488:usr/local/tomcat/webapps/
    

提交回复
热议问题