docker-cp
copy files between containers and the host
TLDR
Copy file from container to host
SYNOPSIS
docker cp [options] container:srcpath destpath
docker cp [options] srcpath container:destpath
DESCRIPTION
docker cp copies files or directories between a container's filesystem and the local host filesystem, functioning bidirectionally for both container-to-host and host-to-container transfers. This command works with both running and stopped containers, making it useful for extracting logs, injecting configuration files, or backing up data.
The command uses tar internally for efficient transfer, streaming data between the container and host. Archive mode (-a) preserves file ownership and permissions, which is important when copying system files or maintaining consistent file attributes.
Unlike volume mounts which are configured at container creation, docker cp enables ad-hoc file transfer at any time during a container's lifecycle.
PARAMETERS
-a, --archive
Archive mode (copy all uid/gid information).-L, --follow-link
Follow symbolic links in source path.-q, --quiet
Suppress progress output.
SEE ALSO
docker-container-cp(1), docker(1)
