下载地址

https://github.com/goharbor/harbor/releases

前置条件

  1. 安装 docker:
    参见:yum 安装 docker20.10.17

  2. 安装 docker-compose:
    参见:yum 安装 docker-compose1.29.2

安装

  1. 下载并解压:

    wget https://github.com/goharbor/harbor/releases/download/v2.7.2/harbor-offline-installer-v2.7.2.tgz
    tar -xzf harbor-offline-installer-v2.7.2.tgz
  2. 进入 harbor 解压目录:
    cd harbor

  3. 修改配置:

    cp harbor.yml.tmpl harbor.yml
    vim harbor.yml
    # 修改主机名
    hostname: xx.xx.xx.xx
    # 修改端口
    http:
     port: 9011
    # 注释掉 https(略)
    # 修改登录密码
    harbor_admin_password: admin123
  4. 安装:
    ./install.sh

  5. 启动/重启:
    docker-compose up -d

配置并重启 docker

  1. 修改配置:
    vim /etc/docker/daemon.json

     {
         ...
         "insecure-registries": [
             "xx.xx.xx.xx:9011"
         ]
     }
  2. 重启 docker:
    systemctl restart docker

访问地址

xx.xx.xx.xx:9011

使用

  1. 登录:
    docker login -u admin -p admin123 xx.xx.xx.xx:9011

  2. 推送镜像:

    # 打标签
    docker tag my-image:v1.0 xx.xx.xx.xx:9011/library/my-image:v1.0
    # 推送
    docker push xx.xx.xx.xx:9011/library/my-image:v1.0
  3. 拉取镜像:
    docker pull xx.xx.xx.xx:9011/library/my-image:v1.0

文档更新时间: 2024-04-20 10:57   作者:lee