commands.sh

docker container cp

all

Copy files or directories between host and container filesystems.

More info →

Options (2)

boolean

Copy a file or directory from the host to a container

Example: docker {{[cp|container cp]}} {{path/to/file_or_directory_on_host}} {{container_name}}:{{path/to/file_or_directory_in_container}}
-L, --follow-linkboolean

Copy a file or directory from the host to a container, following symlinks (copies the symlinked files directly, not the symlinks themselves)

Example: docker {{[cp|container cp]}} {{[-L|--follow-link]}} {{path/to/symlink_on_host}} {{container_name}}:{{path/to/file_or_directory_in_container}}

Examples (3)

Copy a file or directory from the host to a container

docker [cp|container cp] path/to/file_or_directory_on_host container_name:path/to/file_or_directory_in_container

Copy a file or directory from a container to the host

docker [cp|container cp] container_name:path/to/file_or_directory_in_container path/to/file_or_directory_on_host

Copy a file or directory from the host to a container, following symlinks (copies the symlinked files directly, not the symlinks themselves)

docker [cp|container cp] [-L|--follow-link] path/to/symlink_on_host container_name:path/to/file_or_directory_in_container
made by @shridhargupta | data from tldr-pages