zoukankan      html  css  js  c++  java
  • 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发布镜像就不用多说了,很简单

     

     

     

     

  • 相关阅读:
    什么是看板方法?
    瓶颈法则
    累积流图——你还没有用过吗?
    为什么我们关注看板方法?
    蒟蒻报道
    博客更换通知
    浅谈树套树(线段树套平衡树)&学习笔记
    浅谈FFT(快速博立叶变换)&学习笔记
    题解 洛谷P1903/BZOJ2120【[国家集训队]数颜色 / 维护队列】
    题解 洛谷P4550/BZOJ1426 【收集邮票】
  • 原文地址:https://www.cnblogs.com/xtjatswc/p/10292250.html
Copyright © 2011-2022 走看看