Harbor 安装官网手册:
https://goharbor.io/docs/2.10.0/install-config/download-installer/
Harbor 发布包地址:
https://github.com/goharbor/harbor/releases
-
在部署harbor的前提下先安装docker 和 docker-compose
安装docker:https://docs.docker.com/engine/install/centos/
安装docker-compos: https://docs.docker.com/compose/install/standalone/ -
下载 Offline installer 安装包(如果网络慢可以选择科学上网下载到服务器上)
wget -P /opt -https://github.com/goharbor/harbor/releases/download/v2.9.3-rc1/harbor-offline-installer-v2.9.3-rc1.tgz -
解压
# tar -zxvf harbor-offline-installer-v2.9.3-rc1.tgz
# tree harbor harbor ├── common.sh ├── harbor.v2.9.3.tar.gz ├── harbor.yml.tmpl ├── install.sh ├── LICENSE └── prepare 0 directories, 6 files
-
配置文件各项含义
配置文件模版为
harbor.yml.tmpl
使用时,将cp harbor.yml.tmpl harbor.yml
官网配置文件文档:https://goharbor.io/docs/2.10.0/install-config/configure-yml-file/
-
修改配置文件
# cp harbor.yml.tmpl harbor.yml # cat harbor.yml
hostname: 192.168.44.161 # 由于harbor是docker部署,所有这里需要写宿主机的IP(可以访问的域名) # 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: /your/certificate/path # private_key: /your/private/key/path ...... 其他的可以默认
-
安装Harbor
默认的 Harbor 安装不包括 Trivy 服务。运行以下命令./install.sh
要使用 Trivy 服务安装 Harbor,请–with-trivy在运行时添加参数install.sh:
./install.sh --with-trivy
-
使用查看所有服务
# docker-compose ls
# docker-compose ls NAME STATUS CONFIG FILES harbor running(10) /opt/harbor/docker-compose.yml
# docker-compose ps # 需要在yaml文件同级目录下执行 NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS harbor-core goharbor/harbor-core:v2.9.3 "/harbor/entrypoint.…" core 13 minutes ago Up 13 minutes (healthy) harbor-db goharbor/harbor-db:v2.9.3 "/docker-entrypoint.…" postgresql 13 minutes ago Up 13 minutes (healthy) harbor-jobservice goharbor/harbor-jobservice:v2.9.3 "/harbor/entrypoint.…" jobservice 13 minutes ago Up 13 minutes (healthy) harbor-log goharbor/harbor-log:v2.9.3 "/bin/sh -c /usr/loc…" log 13 minutes ago Up 13 minutes (healthy) 127.0.0.1:1514->10514/tcp harbor-portal goharbor/harbor-portal:v2.9.3 "nginx -g 'daemon of…" portal 13 minutes ago Up 13 minutes (healthy) nginx goharbor/nginx-photon:v2.9.3 "nginx -g 'daemon of…" proxy 13 minutes ago Up 13 minutes (healthy) 0.0.0.0:80->8080/tcp, :::80->8080/tcp redis goharbor/redis-photon:v2.9.3 "redis-server /etc/r…" redis 13 minutes ago Up 13 minutes (healthy) registry goharbor/registry-photon:v2.9.3 "/home/harbor/entryp…" registry 13 minutes ago Up 13 minutes (healthy) registryctl goharbor/harbor-registryctl:v2.9.3 "/home/harbor/start.…" registryctl 13 minutes ago Up 13 minutes (healthy) trivy-adapter goharbor/trivy-adapter-photon:v2.9.3 "/home/scanner/entry…" trivy-adapter 13 minutes ago Up 13 minutes (healthy)
-
管理 harbor
停止# docker-compose down -v
启动
# docker-compose up -d
-
访问harbor
默认账号密码是: admin/Harbor12345