From 9114864ace04a61953659d67145cbe605d25b829 Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Tue, 24 May 2016 14:06:02 +0200 Subject: [PATCH] Merge pull request #22900 from AkihiroSuda/fix22020 update docs/reference/commandline/cp.md (cherry picked from commit 6a385a00226dc7d8a35406ae284bb6731444d524) Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/cp.md | 12 +++++++++++- man/docker-cp.1.md | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/docs/reference/commandline/cp.md b/docs/reference/commandline/cp.md index 841aeb36e0..8afabc95bc 100644 --- a/docs/reference/commandline/cp.md +++ b/docs/reference/commandline/cp.md @@ -81,7 +81,17 @@ you must be explicit with a relative or absolute path, for example: `/path/to/file:name.txt` or `./file:name.txt` It is not possible to copy certain system files such as resources under -`/proc`, `/sys`, `/dev`, and mounts created by the user in the container. +`/proc`, `/sys`, `/dev`, [tmpfs](run.md#mount-tmpfs-tmpfs), and mounts created by +the user in the container. However, you can still copy such files by manually +running `tar` in `docker exec`. For example (consider `SRC_PATH` and `DEST_PATH` +are directories): + + $ docker exec foo tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | tar Cxf DEST_PATH - + +or + + $ tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | docker exec -i foo tar Cxf DEST_PATH - + Using `-` as the `SRC_PATH` streams the contents of `STDIN` as a tar archive. The command extracts the content of the tar to the `DEST_PATH` in container's diff --git a/man/docker-cp.1.md b/man/docker-cp.1.md index 84d64c2688..949d60bb8b 100644 --- a/man/docker-cp.1.md +++ b/man/docker-cp.1.md @@ -78,7 +78,16 @@ you must be explicit with a relative or absolute path, for example: `/path/to/file:name.txt` or `./file:name.txt` It is not possible to copy certain system files such as resources under -`/proc`, `/sys`, `/dev`, and mounts created by the user in the container. +`/proc`, `/sys`, `/dev`, tmpfs, and mounts created by the user in the container. +However, you can still copy such files by manually running `tar` in `docker exec`. +For example (consider `SRC_PATH` and `DEST_PATH` are directories): + + $ docker exec foo tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | tar Cxf DEST_PATH - + +or + + $ tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | docker exec -i foo tar Cxf DEST_PATH - + Using `-` as the `SRC_PATH` streams the contents of `STDIN` as a tar archive. The command extracts the content of the tar to the `DEST_PATH` in container's