Home  >  Article  >  Operation and Maintenance  >  Detailed explanation of docker cp command

Detailed explanation of docker cp command

王林
王林forward
2020-08-12 17:09:436236browse

Detailed explanation of docker cp command

The docker cp command can copy files or directories between the container and the local file system of the machine executing the command.

(Recommended: docker tutorial)

1. Use the format

(1) Copy the file or directory from the container to the machine where the command is executed. Specify the path

docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-

(2) Copy the file or directory from the machine where the command is executed to the specified path inside the container

docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH

2. Unique option description

  • --follow-link, -L, always follow the symbol link in SRC_PATH

3. Function description

## The #docker cp command is similar to the cp -a command in UNIX, recursively copying all subdirectories and files in the directory. -Indicates reading or writing tar files in a stream through the standard input/output device.

The path in the local file system can be an absolute path or a relative path. The paths in the container relative to the path of the current command execution are all relative to the /root path of the container. The container being operated can be running or stopped. Files under /proc, /sys, /dev, tmpfs and the mount path in the container cannot be copied.

4、Example

docker cp ~/ba-208/. ${CONTAINER}:/home/myname/ba
docker cp ./. ${CONTAINER}:/home/myname/ba

The above is the detailed content of Detailed explanation of docker cp command. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete