美文网首页
11 发布自己的镜像

11 发布自己的镜像

作者: 亦是旅人呐 | 来源:发表于2021-03-17 10:50 被阅读0次

    发布到docker hub

    1、地址https://hub.docker.com/注册账号
    2、确定账号正常登陆
    3、在我们服务器上提交自己的镜像

    # 查看login命令
    [hekai@localhost ~]$ docker login --help
    
    Usage:  docker login [OPTIONS] [SERVER]
    
    Log in to a Docker registry.
    If no server is specified, the default is defined by the daemon.
    
    Options:
      -p, --password string   Password
          --password-stdin    Take the password from stdin
      -u, --username string   Username
    

    4、登陆完成后就可以提交镜像了

    [hekai@localhost ~]$ docker login -u cyano01
    Password:
    WARNING! Your password will be stored unencrypted in /home/hekai/.docker/config.json.
    Configure a credential helper to remove this warning. See
    https://docs.docker.com/engine/reference/commandline/login/#credentials-store
    
    Login Succeeded
    [hekai@localhost ~]$ 
    

    一步docker push

    # 直接push会被拒绝
    [hekai@localhost ~]$ docker push diytomcat
    Using default tag: latest
    The push refers to repository [docker.io/library/diytomcat]
    e167e05de1b5: Preparing
    79e2f289db2f: Preparing
    8a26f9bbd84d: Preparing
    62e4a193e44f: Preparing
    2653d992f4ef: Preparing
    denied: requested access to the resource is denied
    
    # push镜像的问题?
    [hekai@localhost ~]$ docker push cyano01/diytomcat:1.0
    The push refers to repository [docker.io/cyano01/diytomcat]
    An image does not exist locally with the tag: cyano01/diytomcat
    [hekai@localhost ~]$ 
    
    # 解决:增加一个tag
    [hekai@localhost ~]$ docker tag 5f53b8346cfd cyano01/tomcat:1.0
    [hekai@localhost ~]$ docker images
    REPOSITORY            TAG       IMAGE ID       CREATED         SIZE
    diytomcat             latest    5f53b8346cfd   10 hours ago    665MB
    cyano01/tomcat        1.0       5f53b8346cfd   10 hours ago    665MB
    
    # 尽量带上版本号
    [hekai@localhost ~]$ docker push cyano01/tomcat:1.0
    The push refers to repository [docker.io/cyano01/tomcat]
    e167e05de1b5: Pushing [===================>                               ]  22.18MB/58.2MB
    79e2f289db2f: Pushing [==============>                                    ]  4.509MB/15.9MB
    8a26f9bbd84d: Pushing [=>                                                 ]  9.308MB/381.7MB
    62e4a193e44f: Pushed
    2653d992f4ef: Pushing [==>                                                ]  10.42MB/209.3MB
    

    可以发现,提交的时候也是按照镜像的层级来进行提交的

    发布到阿里云镜像

    1、登陆阿里云
    2、找到容器镜像服务
    3、创建命名空间
    4、创建容器镜像
    5、浏览阿里云

    小结

    相关文章

      网友评论

          本文标题:11 发布自己的镜像

          本文链接:https://www.haomeiwen.com/subject/mmdjcltx.html