docker镜像导出导入

2023-09-01  本文已影响0人  xlgao

export 和 import

  1. 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

  1. docker import gitlab12.tar gitlab:12

save和load

  1. 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

  1. 从归档文件导入
    docker load -i gitlab12.tar
    docker load < gitlab12.tar
上一篇下一篇

猜你喜欢

热点阅读