zoukankan      html  css  js  c++  java
  • harbor

    harbor 搭建

    详细请看另一篇https://www.cnblogs.com/outsrkem/p/12597759.html

    环境

    CentOS 7.4

    harbor-v1.9.1

    底层需求

    Python 应该是 2.7 或更高版本
    Docker 引擎应为 1.10 或更高版本
    Docker Compose 需要为 17.06.0+ 或更高版本
    安装 docker-compose 命令或者直接导入命令到 /usr/local/bin/

    curl -L https://github.com/docker/compose/releases/download/1.25.0/docker-compose-`uname -s`-`uname -m` 
    -o /usr/local/bin/docker-compose
    chmod +x /usr/local/bin/docker-compose
    

    修改主机名

    hostnamectl set-hostname harbor.hub.com
    

    下载harbor

    wget https://github.com/goharbor/harbor/releases/download/v1.9.3/harbor-offline-installer-v1.9.3.tgz
    

    创建证书

    mkdir -p /home/harbor/certs
    cd /home/harbor
    openssl req 
    -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key 
    -x509 -days 365 -out certs/domain.crt 
    -subj /C=CN/ST=BJ/L=BJ/O=DEVOPS/CN=harbor.hub.com
    
    # Be sure to use the name myregistrydomain.com as a CN.
    

    也可以使用cfssl创建证书,点击跳转

    修改配置

    # The IP address or hostname to access admin UI and registry service.
    # DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
    hostname: harbor.hub.com     # 此处修改
    
    # http related config
    #http:     # 此处修改
      # port for http, default is 80. If https enabled, this port will redirect to https port
    #  port: 80  # 此处修改
    
    # https related config
    https:  # 此处修改
    #   # https port for harbor, default is 443
      port: 443  # 此处修改
    #   # The path of cert and key files for nginx
      certificate: /home/harbor/certs/domain.crt  # 此处修改
      private_key: /home/harbor/certs/domain.key  # 此处修改
    
    
    
    ······
    # The default data volume
    data_volume: /home/harbor/data   # 此处修改
    
    ······
    

    启动harbor

    ./install.sh
    

    访问

    https://harbor.hub.com 设置 hosts 映射文件。默认管理员用户名 / 密码为 admin / Harbor12345
    

    指定镜像仓库地址

    vim /etc/docker/daemon.json
    {
      "insecure-registries": ["harbor.hub.com"]
    }
    
    

    下载测试镜像

    docker pull hello-world
    

    给镜像重新打标签

    docker tag hello-world:latest harbor.hub.com/library/word:latest
    
    docker login harbor.hub.com -uadmin -pHarbor12345
    
    docker push harbor.hub.com/library/word:latest
    


    作者:Outsrkem
    出处:https://www.cnblogs.com/outsrkem/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    Study Plan The TwentySecond Day
    Study Plan The Nineteenth Day
    Study Plan The TwentySeventh Day
    Study Plan The Twentieth Day
    Study Plan The TwentyFirst Day
    python实现进程的三种方式及其区别
    yum makecache
    JSONPath 表达式的使用
    oracle执行cmd的实现方法
    php daodb插入、更新与删除数据
  • 原文地址:https://www.cnblogs.com/outsrkem/p/11921319.html
Copyright © 2011-2022 走看看