mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #22900 from AkihiroSuda/fix22020
update docs/reference/commandline/cp.md
This commit is contained in:
commit
6a385a0022
2 changed files with 21 additions and 2 deletions
|
@ -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`
|
`/path/to/file:name.txt` or `./file:name.txt`
|
||||||
|
|
||||||
It is not possible to copy certain system files such as resources under
|
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.
|
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
|
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:
|
||||||
`/path/to/file:name.txt` or `./file:name.txt`
|
`/path/to/file:name.txt` or `./file:name.txt`
|
||||||
|
|
||||||
It is not possible to copy certain system files such as resources under
|
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.
|
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
|
The command extracts the content of the tar to the `DEST_PATH` in container's
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue