直接上代码
sudo docker cp txcrm2:/home/log/production.log /system/logs ##仔细看 txcrm2是镜像id ,后面就是文件路径以及复制到宿主机的文件路径1
从主机复制到容器sudo docker cp host_path containerID:container_path
从容器复制到主机sudo docker cp containerID:container_path host_path
最后拷贝到本地使用scp
scp tongxin@120.120.120.1:/logs/production.log/Users/guoyoujin/Documents/rails/txcrm
; < /path/to/host/file/
或者
[plain] view plaincopy
docker exec -itbash -c 'cat > /path/to/container/file' < /path/to/host/file/