镜像上传、存入、存出

首先得去https://www.docker.com/  官网注册一个账号


1.上传镜像

[root@localhost docker]# docker tag test:latest dy1999/test:latest

[root@localhost docker]# docker login  输入刚才注册的用户名和密码

Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.

Username: dy1999

Password: 

Login Succeeded

[root@localhost docker]# docker push dy1999/test:latest   其中dy1999为我刚注册的用户名  test为docker网站上的仓库名 没有会自动创建  latest为标签

The push refers to a repository [docker.io/dy1999/test]

a473a4bafa40: Pushed 

a8de0e025d94: Pushed 

a5e66470b281: Pushed 

ac7299292f8b: Pushed 

e1a9a6284d0d: Pushed 

fccbfa2912f0: Pushed 

latest: digest: sha256:3545bfcb3fd004ce0c3489a5f10dbbf92187ea2cb89c0aaf6e5c3946981b263f size: 1564



2.存出

https://openvz.org/Download/template/precreated 下载ubuntu-14.04-x86_64-minimal.tar.gz

cd  /var/opt/docker   上传文件 ubuntu-14.04-x86_64-minimal.tar.gz

[root@localhost docker]# sudo cat ubuntu-14.04-x86_64-minimal.tar.gz |docker import - ubuntu:14.04

会输出sha256:cd7ac3dace3edc17b80b933a2c43976be0068c83fb749d8fc7a559a04f43dcdf


[root@localhost docker]# docker images

REPOSITORY                 TAG                 IMAGE ID            CREATED              SIZE

ubuntu                     14.04               cd7ac3dace3e        About a minute ago   215 MB

test                       latest              131466eb2ab0        23 minutes ago       113 MB

docker.io/ubuntu           latest              c9d990395902        4 days ago           113 MB

docker.io/centos           latest              e934aafc2206        10 days ago          199 MB

docker.io/learn/tutorial   latest              a7876479f1aa        5 years ago          128 MB

存出本地的镜像为文件ubuntu_14.04.tar

[root@localhost docker]# docker save -o ubuntu_14.04.tar  ubuntu:14.04  

会 在/var/opt/docker 创建ubuntu_14.04.tar文件



3.存入

docker load --input ubuntu_14.04.tar 载入镜像

或者docker load < ubuntu_14.04.tar


[root@localhost docker]# docker load < ubuntu_14.04.tar

输出Loaded image: ubuntu:14.04


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值