搭建harbor私有仓库

搭建harbor私有仓库

  1. 安装docker-compose

  2. 下载harbor offline 线下包 https://github.com/goharbor/harbor/releases

  3. 解压缩harbor相关包 tar -zxvf harbor-offline-installer-v2.5.2.tgz

  4. 修改harbor配置文件

    # Configuration file of Harbor
    
    
    #设置为自己主机的host那么
    hostname: 192.168.209.100
    
    # http related config
    http:
      # port for http, default is 80. If https enabled, this port will redirect to https port # 默认是80建议修改
      port: 5000
    
    # https related config 如果没有使用https 注释这段
    #https:
    #  # https port for harbor, default is 443
    #  port: 443
      # The path of cert and key files for nginx
    #  certificate: /your/certificate/path
    #  private_key: /your/private/key/path
    
    # harbor web页面admin的登陆密码
    harbor_admin_password: 123456
    
    # Harbor DB configuration
    database:
      # The password for the root user of Harbor DB. Change this before any production use.
      password: root123
      # The maximum number of connections in the idle connection pool. If it <=0, no idle connections are retained.
      max_idle_conns: 100
      # The maximum number of open connections to the database. If it <= 0, then there is no limit on the number of open connections.
      # Note: the default number of connections is 1024 for postgres of harbor.
      max_open_conns: 900
    
    # harbor数据存放目录
    data_volume: /usr/local/harbor/data
    
    
  5. 如果不使用https加密证书修改docker的/etc/docker/daemon.json配置文件添加insecure-registries

    {"registry-mirrors": ["http://f1361db2.m.daocloud.io"],"insecure-registries": ["192.168.209.100:5000"]}
    
  6. 重启docker systemctl restart docker

  7. 安装harbor ./install.sh

  8. 访问web页面 192.168.209.100:500 使用 admin/123456进行登陆

在这里插入图片描述

  1. 添加用户 并设置为管理员

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-L2h3lunE-1657251335252)(https://gitee.com/jianimaoju/image-storage-service/raw/master/image/202207/06/153116-141420.png)]

  2. 创建项目

在这里插入图片描述

  1. 项目中添加用户

在这里插入图片描述

  1. docker login + docker tag + docker push

    [root@node1 harbor]# docker login 192.168.209.100:5000
    Authenticating with existing credentials...
    WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
    Configure a credential helper to remove this warning. See
    https://docs.docker.com/engine/reference/commandline/login/#credentials-store
    
    Login Succeeded
    # docker tag SOURCE_IMAGE[:TAG] 192.168.209.100:5000/test/REPOSITORY[:TAG]
    docker tag nginx 192.168.209.100:500/test/mynginx:v1
    # docker push 192.168.209.100:5000/test/REPOSITORY[:TAG]
    docker push 192.168.209.100:500/test/mynginx:v1
    
    
  2. 其他服务器登陆harbor 拉取镜像

    docker login
    docker pull 192.168.209.100:500/test/mynginx:v1
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值