The docker cp utility
copies the contents of SRC_PATH to the DEST_PATH. You can copy
from the container’s file system to the local machine or the reverse, from the
local filesystem to the container.
The docker
cp command assumes container paths are relative to the
container’s / (root) directory. This means supplying the initial
forward slash is optional;
Below mentioned commands
are treated as identical:
- myContainer:/tmp/myFile.txt
- myContainer:tmp/myFile.txt
Local machine paths can
be an absolute or relative value.
The command interprets a
local machine’s relative paths as relative to the current working directory
where docker cp is run.
Copying Remote Server File to Docker Container:
docker cp
[source_pathOfFile_RemoteServer] [docker_containerName]:[destination_path_dockerContainer]
docker cp
/tmp/myFile.xls myContainer:/tmp/
Copying Docker Container File to Remote Server:
docker cp
[docker_containerName]:[sourcepathOfFile_dockerContainer] [destination_pathOfFile_RemoteServer]
docker cp
myContainer:/tmp/myFile.xls /tmp/myFile.xls
Note: These commands need to be executed from
Remote Server on which docker is installed and any docker container is up and
running.
Resources:
· https://docs.docker.com/engine/reference/commandline/cp/
No comments:
Post a Comment