Docker镜像推送(push)到Docker Hub

镜像构建成功后,只要有docker环境就可以使用,但必须将镜像推送到Docker Hub上去。我们之前创建的镜像不符合Docker Hub的tag要求,因为 在Docker Hub注册的用户名是boonyadocker而不是boonya,所以需要docker tag进行修改,最后利用docker push命令推送镜像到公共仓库。

Docker hub注册用户

到官网注册账号:https://hub.docker.com/

在本地Linux登录docker:

docker login 

输入用户名密码进行登录:

docker@default:~$ 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: boonyadocker  
Password:   
Login Succeeded  
docker@default:~$   

tag修改镜像名称

推送镜像的规范是:

docker push 注册用户名/镜像名  

tag命令修改为规范的镜像:

[root@localhost tmp]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
xtjatswc/mycore     latest              73ce3cd97c01        About an hour ago   1.74GB
microsoft/dotnet    latest              521411f3b61d        4 days ago          1.73GB
[root@localhost tmp]# docker tag xtjatswc/mycore:latest xtjatswc/mycore2:v3
[root@localhost tmp]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
xtjatswc/mycore2    v3                  73ce3cd97c01        About an hour ago   1.74GB
xtjatswc/mycore     latest              73ce3cd97c01        About an hour ago   1.74GB
microsoft/dotnet    latest              521411f3b61d        4 days ago          1.73GB
[root@localhost tmp]# 

推送镜像到Docker Hub

通过push命令推送镜像:

docker push xtjatswc/mycore2:v3  

注:推送Docker Hub速度很慢,耐心等待,很有可能失败,失败会尝试多次重传,之后断开推送(但已推送上去的会保留,保留时间不知道是多久)。

 

 

访问Docker Hub发布镜像就不用多说了,很简单

 

 

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值