How to copy files from host to Docker container?

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

    To copy files/folders between a container and the local filesystem, type the command:

    docker cp {SOURCE_FILE} {DESTINATION_CONTAINER_ID}:/{DESTINATION_PATH}
    

    For example,

    docker cp /home/foo container-id:/home/dir
    

    To get the contianer id, type the given command:

    docker ps
    

    The above content is taken from docker.com.

提交回复
热议问题