Browse code

update docs/reference/commandline/cp.md

Close #22020

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>

Akihiro Suda authored on 2016/05/23 18:10:14
Showing 2 changed files
... ...
@@ -81,7 +81,17 @@ you must be explicit with a relative or absolute path, for example:
81 81
     `/path/to/file:name.txt` or `./file:name.txt`
82 82
 
83 83
 It is not possible to copy certain system files such as resources under
84
-`/proc`, `/sys`, `/dev`, and mounts created by the user in the container.
84
+`/proc`, `/sys`, `/dev`, [tmpfs](run.md#mount-tmpfs-tmpfs), and mounts created by
85
+the user in the container. However, you can still copy such files by manually
86
+running `tar` in `docker exec`. For example (consider `SRC_PATH` and `DEST_PATH`
87
+are directories):
88
+
89
+    $ docker exec foo tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | tar Cxf DEST_PATH -
90
+
91
+or
92
+
93
+    $ tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | docker exec -i foo tar Cxf DEST_PATH -
94
+
85 95
 
86 96
 Using `-` as the `SRC_PATH` streams the contents of `STDIN` as a tar archive.
87 97
 The command extracts the content of the tar to the `DEST_PATH` in container's
... ...
@@ -78,7 +78,16 @@ you must be explicit with a relative or absolute path, for example:
78 78
     `/path/to/file:name.txt` or `./file:name.txt`
79 79
 
80 80
 It is not possible to copy certain system files such as resources under
81
-`/proc`, `/sys`, `/dev`, and mounts created by the user in the container.
81
+`/proc`, `/sys`, `/dev`, tmpfs, and mounts created by the user in the container.
82
+However, you can still copy such files by manually running `tar` in `docker exec`.
83
+For example (consider `SRC_PATH` and `DEST_PATH` are directories):
84
+
85
+    $ docker exec foo tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | tar Cxf DEST_PATH -
86
+
87
+or
88
+
89
+    $ tar Ccf $(dirname SRC_PATH) - $(basename SRC_PATH) | docker exec -i foo tar Cxf DEST_PATH -
90
+
82 91
 
83 92
 Using `-` as the `SRC_PATH` streams the contents of `STDIN` as a tar archive.
84 93
 The command extracts the content of the tar to the `DEST_PATH` in container's