improve cp documentation with some illustration examples
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
ab7cc48580
commit
41a5e0e4df
@ -89,6 +89,28 @@ 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`
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Copy a local file into container
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker cp ./some_file CONTAINER:/work
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy files from container to local path
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker cp CONTAINER:/var/logs/ /tmp/app_logs
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy a file from container to stdout. Please note `cp` command produces a tar stream
|
||||||
|
|
||||||
|
```console
|
||||||
|
$ docker cp CONTAINER:/var/logs/app.log - | tar x -O | grep "ERROR"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Corner cases
|
||||||
|
|
||||||
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`, [tmpfs](run.md#mount-tmpfs---tmpfs), and mounts created by
|
`/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
|
the user in the container. However, you can still copy such files by manually
|
||||||
|
Loading…
x
Reference in New Issue
Block a user