20

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 https://github.com/moby/moby/issues/7710 shows that wildcards are not presently supported. So is the only option here to create an archive and cp / untar that?

Franck Dernoncourt
  • 24,246
  • 64
  • 231
  • 400

1 Answers1

26

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.