博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
导出、恢复、上传镜像
阅读量:6995 次
发布时间:2019-06-27

本文共 1126 字,大约阅读时间需要 3 分钟。

[root@localhost ~]# docker imagesREPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZEcentos-6-x86        latest              8fca9486a39b        About a minute ago   341.3 MBcentos_with_net     latest              3e8ea8607f08        2 weeks ago          294.9 MBcentos              latest              9baab0af79c4        4 weeks ago          196.7 MB

把现有镜像导出为一个文件

[root@localhost ~]# docker save -o centos_with_net.tar 3e8ea8607f08

3e8ea8607f08是镜像的ID,也可以换成镜像名字centos_with_net,导出的文件生成在当前目录下

[root@localhost ~]# lsanaconda-ks.cfg              centos_with_net.tar  install.log.syslog  模板  图片  下载  桌面centos-6-x86-minimal.tar.gz  install.log          公共的              视频  文档  音乐[root@localhost ~]# du -sh centos_with_net.tar289M    centos_with_net.tar

用导出文件恢复本地镜像

[root@localhost ~]# docker load < centos_with_net.tar

或者

[root@localhost ~]# docker load --input centos_with_net.tar

上传镜像

可以使用docker push命令上传镜像到仓库,默认上传到DockerHub官方仓库,命令格式为docker push NAME[:TAG]。

用户在DockerHub网站注册后,即可上传自制的镜像。

docker push image_name

第一次使用时,会提示输入登录信息或进行注册。

转载于:https://www.cnblogs.com/Genesis2018/p/8304721.html

你可能感兴趣的文章