从容器内拷贝文件到主机上
[root@oegw1 soft]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8d418a7b6021 postgres "/docker-entrypoint. 7 hours ago Up 7 hours test1
将容器内文件拷贝到主机上
docker cp 8d418a7b6021:/var/lib/postgresql/data /opt/soft/
将8d418a7b6021容器/var/lib/postgresql/data下的文件复制到主机/opt/soft/ 中
从主机上拷贝文件到容器内
docker cp ./HRoad.osm d72:/data/HRoad.osm
将主机HRoad.osm 文件复制到d72容器中/data/HRoad.osm