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
    

     

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

  • 相关阅读:
    网站备案 应该找域名商还是空间商备案
    备案的问题
    js发送邮件确定email地址
    How to Create a First Shell Script
    虚拟主机和网站空间有什么区别?
    linux 单引号,双引号,反引号
    linux 中的单引号 和双引号有什么区别吗
    linux awk命令详解
    shell中$0,$?,$!等的特殊用法
    深圳测试协会第二次管理层会议成功召开!
  • 原文地址:https://www.cnblogs.com/xiaozhican/p/10306871.html
Copyright © 2011-2022 走看看