docker镜像导出导入
export 和 import
- export是将正在运行的docker容器导出为归档文件,方便在其他地方导入
root@xlgao:/opt# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1f51cb682bc8 gitlab/gitlab-ce:12.0.12-ce.0 "/assets/wrapper" 20 hours ago Up 20 hours (healthy) 172.16.6.189:22->22/tcp, 172.16.6.189:80->80/tcp, 172.16.6.189:443->443/tcp gitlab-jenkins
a1f4cbee7d18 jenkinsci/blueocean "/sbin/tini -- /usr/…" 13 days ago Up 12 days 0.0.0.0:8080->8080/tcp, 0.0.0.0:50000->50000/tcp inspiring_tu
root@xlgao:/opt# docker export -o gitlab12.tar 1f51cb682bc8
- docker import gitlab12.tar gitlab:12
save和load
- save是从镜像导出到归档文件
docker save -o gitlab12.tar gitlab/gitlab-ce:12.0.12-ce.0
docekr save > gitlab12.tar gitlab/gitlab-ce:12.0.12-ce.0
- 从归档文件导入
docker load -i gitlab12.tar
docker load < gitlab12.tar