导出、恢复、上传镜像

[root@localhost ~]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED              VIRTUAL SIZE
centos-6-x86        latest              8fca9486a39b        About a minute ago   341.3 MB
centos_with_net     latest              3e8ea8607f08        2 weeks ago          294.9 MB
centos              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 ~]# ls
anaconda-ks.cfg              centos_with_net.tar  install.log.syslog  模板  图片  下载  桌面
centos-6-x86-minimal.tar.gz  install.log          公共的              视频  文档  音乐
[root@localhost ~]# du -sh centos_with_net.tar
289M    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/9079801.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值