In order to copy a file from a container to the host, you can use the command
(为了将文件从容器复制到主机,可以使用以下命令)
docker cp <containerId>:/file/path/within/container /host/path/target
Here's an example:
(这是一个例子:)
$ sudo docker cp goofy_roentgen:/out_read.jpg .
Here goofy_roentgen is the container name I got from the following command:
(这里goofy_roentgen是我从以下命令获得的容器名称:)
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1b4ad9311e93 bamos/openface "/bin/bash" 33 minutes ago Up 33 minutes 0.0.0.0:8000->8000/tcp, 0.0.0.0:9000->9000/tcp goofy_roentgen
You can also use (part of) the Container ID .
(您还可以使用(部分) 容器ID 。)
The following command is equivalent to the first (以下命令等效于第一个)
$ sudo docker cp 1b4a:/out_read.jpg .
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…