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
    

     

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

  • 相关阅读:
    jquery click()方法模拟点击事件对a标签不生效
    键盘keyCode
    java配置好jdk-bash: /usr/bin/java: No such file or directory
    iptables配置顺序-两条规则会忽略后边的
    一些非常实用的JSON 教程
    C#实现json的序列化和反序列化
    [asp.net]C#实现json的序列化和反序列化
    一些JSON 教程
    js+JQuery实现返回顶部功能
    HTML标签总结
  • 原文地址:https://www.cnblogs.com/xiaozhican/p/10306871.html
Copyright © 2011-2022 走看看