zoukankan      html  css  js  c++  java
  • docker将镜像上传到私有仓库harbor

    1.docker push  命令是镜像上传到远程仓库,默认是上传到官方的仓库,但是我们上传不了,没有账号

    2.   那么我们要将本地的镜像打标签 指向我们自己的仓库

                             

    docker tag hello-world 192.168.255.131:8888/tony/hello-world:v1.0    //hello-world是本地镜像  后面是私有仓库的地址/项目名称/镜像名称:版本号
    

    3.docker  images  可以看到刚才打了标签的镜像,docker push  直接上传镜像

    docker  push  192.168.255.131:8888/tony/hello-world

     上传的过程中 报错了

               

    The push refers to repository [hd-01:8888/tony/hello-world]
    Get https://hd-01:8888/v2/: http: server gave HTTP response to HTTPS client
    [root@hd-01 harbor]# docker  push  docker tag hello-world hd-01:8888/tony/hello-world
    

     默认采用https协议上传,所以我们要/etc/docker/deamon.json修改配置文件,将私有仓库地址加进去,如果没有则创建vi /etc/docker/deamon.json

    {
       "registry-mirrors": ["https://dhq9bx4f.mirror.aliyuncs.com"],   
       "insecure-registries": ["192.168.255.131:8888"]       
    }
    

     重启docker

    service docker restart
    

    在次上传

    docker  push 192.168.255.131:8888/tony/hello-world

     发现还是有问题

    b7efe781401d: Preparing 
    c9c2a3696080: Preparing 
    7b4e562e58dc: Preparing 
    denied: requested access to the resource is denied
    

    好像是没有权限,默认是推到docker官方库,所以我们要登录自己的私有仓库

    docker login 192.168.255.131:8888
    
    Username:admin
    Password:Harbor12345
    

     在次推送

    docker  push 192.168.255.131:8888/tony/hello-world
    

     

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

  • 相关阅读:
    SVN合并时报错:Merge tracking not allowed with missing subtrees; try restoring these items
    The operation names in the portType match the method names in the SEI or Web service implementation class.
    原生java调用webservice的方法,不用生成客户端代码
    如何快速开发一个支持高效、高并发的分布式ID生成器
    分布式ID生成器解决方案
    高并发分布式系统中生成全局唯一Id汇总
    python接口自动化17-multipart/form-data表单提交
    httprunner学习25-文件上传multipart/form-data
    python测试开发django-72.删除表后如何重新生成表
    python测试开发django-71.自定义标签tag
  • 原文地址:https://www.cnblogs.com/xiaozhican/p/10306871.html
Copyright © 2011-2022 走看看