Recursively copy files using docker cp

Does docker truly only support one file-at-a-time copying to/from the host?

The only options displayed for docker cp are:

 $docker cp --help
Usage: docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|- docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH
Copy files/folders between a container and the local filesystem
Options: -a, --archive Archive mode (copy all uid/gid information) -L, --follow-link Always follow symbol link in SRC_PATH

In addition the jira shows that wildcards are not presently supported .. So is the only option here to create an archive and cp / untar that ?

1 Answer

According to the docker documentation:

The cp command behaves like the Unix cp -a command in that directories are copied recursively with permissions preserved if possible.

This means that docker cp copy files recursively by default.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like