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

Detailed explanation of docker cp command

王林
Release: 2020-08-12 17:09:43
forward
6413 people have browsed it

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|-
Copy after login

(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
Copy after login

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
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template