Docker入门教程:镜像导出导入

获取

1
docker pull gitlab/gitlab-ce #下载1.24GB 安装后2.95GB

输出为

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[hyper@hyper-docker Desktop]$ sudo docker pull gitlab/gitlab-ce
Using default tag: latest
latest: Pulling from gitlab/gitlab-ce
3713021b0277: Pull complete
e82b077a9ea5: Pull complete
51dc1797133d: Pull complete
afe8ed435db4: Pull complete
9b6fd0763a2c: Pull complete
f7050bdc3785: Pull complete
4dd138a01ba8: Pull complete
108a1208d494: Pull complete
b2920d53e0f9: Pull complete
Digest: sha256:e331d46760fece3845bb4022598ecea804927cc0ff51c2f4cbed053af0e88af3
Status: Downloaded newer image for gitlab/gitlab-ce:latest
docker.io/gitlab/gitlab-ce:latest

查看镜像列表

1
2
3
4
5
[hyper@hyper-docker Desktop]$ sudo docker images
[sudo] password for hyper:
REPOSITORY TAG IMAGE ID CREATED SIZE
gitlab/gitlab-ce latest e2e712bc83b9 8 days ago 2.95GB
nginx latest 900dca2a61f5 7 weeks ago 188MB

导出

将gitlab-ce镜像导出

1
sudo docker save -o /home/hyper/gitlab-ce.zip gitlab/gitlab-ce:latest

根据镜像大小耗时不同。

导入

将gitlab-ce导入

1
docker load -i gitlab-ce.zip

说明

  • 若是只想备份images,使用save、load即可
  • 若是在启动容器后,容器内容有变化,需要备份,则使用export、import

Docker入门教程:镜像导出导入
https://blog.jackeylea.com/docker/how-to-export-import-image/
作者
JackeyLea
发布于
2024年8月20日
许可协议