美文网首页容器技术
十三、镜像的导入与导出

十三、镜像的导入与导出

作者: InsaneLoafer | 来源:发表于2021-12-06 13:10 被阅读0次
  1. 导出:docker image save <image_name:tag> -o xxx.image
  • -o:output 即导出
  1. 导入:docker image load -i xxx.image
  • -i:input 即导入
[root@localhost ~]# docker image ls
REPOSITORY               TAG       IMAGE ID       CREATED        SIZE
quay.io/bitnami/nginx    latest    94b72494607b   9 hours ago    90.5MB
busybox                  latest    69593048aa3a   5 months ago   1.24MB
localhost:5002/busybox   v1.0      69593048aa3a   5 months ago   1.24MB
nginx                    1.20.0    7ab27dbbfbdf   6 months ago   133MB
[root@localhost ~]#
[root@localhost ~]# docker image save nginx:1.20.0 -o nginx.image
[root@localhost ~]#
[root@localhost ~]# ls
agent.jar        Desktop         Documents  initial-setup-ks.cfg  Music  nginx.image  Public     test_db-master  Videos
anaconda-ks.cfg  D:\JenkinsNode  Downloads  jenkins               mysql  Pictures     Templates  test.txt
[root@localhost ~]#
[root@localhost ~]# docker image rm 7ab
Untagged: nginx:1.20.0
Untagged: nginx@sha256:ea4560b87ff03479670d15df426f7d02e30cb6340dcd3004cdfc048d6a1d54b4
Deleted: sha256:7ab27dbbfbdf4031f0603a4b597cc43031ff883b54f9329f0309c80952dda6f5
Deleted: sha256:5b2a9404d052ae4205f6139190fd4b0921ddeff17bf2aaf4ee97f79e1a8242fe
Deleted: sha256:03ebf76f0cbf5fd32ca010bb589c2139ce7e44c050fe3de2d77addf4cfd25866
Deleted: sha256:0191669d087dce47072254a93fe55cbedd687f27d3798e2260f846e8f8f5729a
Deleted: sha256:17651c6a0ba04d31da14ac6a86d8fb3f600883f9e155558e8aad0b94aa6540a2
Deleted: sha256:5a673ff4c07a1b606f2ad1fc53697c99c45b0675734ca945e3bb2bd80f43feb8
Deleted: sha256:02c055ef67f5904019f43a41ea5f099996d8e7633749b6e606c400526b2c4b33
[root@localhost ~]#
[root@localhost ~]# docker image load -i nginx.image
02c055ef67f5: Loading layer [==================================================>]  72.53MB/72.53MB
1839f9962bd8: Loading layer [==================================================>]   64.8MB/64.8MB
a2f4f809e04e: Loading layer [==================================================>]  3.072kB/3.072kB
9b63e6289fbe: Loading layer [==================================================>]  4.096kB/4.096kB
f7141923aaa3: Loading layer [==================================================>]  3.584kB/3.584kB
272bc57d3405: Loading layer [==================================================>]  7.168kB/7.168kB
Loaded image: nginx:1.20.0
[root@localhost ~]#
[root@localhost ~]# docker image ls
REPOSITORY               TAG       IMAGE ID       CREATED        SIZE
quay.io/bitnami/nginx    latest    94b72494607b   9 hours ago    90.5MB
busybox                  latest    69593048aa3a   5 months ago   1.24MB
localhost:5002/busybox   v1.0      69593048aa3a   5 months ago   1.24MB
nginx                    1.20.0    7ab27dbbfbdf   6 months ago   133MB

相关文章

网友评论

    本文标题:十三、镜像的导入与导出

    本文链接:https://www.haomeiwen.com/subject/zlnwtrtx.html