Docker host copy (single folder/multiple files/single file) to container

Copy a single folder to the specified directory of the container

My JPEGImages contains multiple images. The following command copies all the files and subdirectories in the JPEGImages directory of the host machine to the /home/PaddleSeg/input/ directory of the 7a7608e0bf84 container

docker cp JPEGImages/. 7a7608e0bf84:/home/PaddleSeg/input/

Copy multiple host files to the specified directory of the container

Use multi-line docker cp command

docker cp JPEGImages/a.png 7a7608e0bf84:/home/PaddleSeg/input/ \
docker cp JPEGImages/b.png 7a7608e0bf84:/home/PaddleSeg/input/

Copy a single file from the container to the host:

docker cp <container ID or name>:<container source path> <host target path>

docker cp 7a7608e0bf84:/home/PaddleSeg/input/a.png JPEGImages/

Copy a single file from the host to the container

docker cp <host target path> <container ID or name>:<container source path>

docker cp JPEGImages/a.png 7a7608e0bf84:/home/PaddleSeg/input/

Guess you like

Origin blog.csdn.net/crazyjinks/article/details/131131182