参考链接
前置准备
harbor 的安装依赖 docker-compose,相关 Issue 《Need to install docker-compose(1.18.0+) by yourself first and run this script again》,为了安装顺利进行,需要额外下载 docker-compose
1 2 3 4 5 6 7 8 9 10 11 12
| sudo apt install docker-compose-plugin
docker compose version >> Docker Compose version v2.10.2
sudo curl -L "https://github.com/docker/compose/releases/download/v2.10.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
|
下载安装
1 2 3 4 5 6 7
| wget https://github.com/goharbor/harbor/releases/download/v1.10.14/harbor-online-installer-v1.10.14.tgz
tar zxvf harbor-online-installer-v1.10.14.tgz
cd harbor/
|
编辑配置文件
1 2 3 4
| vi harbor.yml
# data_volume -> /data/harbor # harbor_admin_password -> SOME_RANDOM_STR
|
标准方式:标准方式需要占用 80 和 443 端口
1 2 3 4
| # http.port -> 80 # https.port -> 443 # https.certificate -> /data/acme/fqk.app/fullchain.cer # https.private_key -> /data/acme/fqk.app/fqk.app.key
|
Nginx 转发方式
1 2 3
| # http.port -> 9080 # external_url -> hub.fqk.app # https 下的所有配置项
|
安装及启动
Nginx 转发
以 hub.fqk.app
和 9080
端口为例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| server { listen 443 ssl;
ssl_certificate ……; ssl_certificate_key ……;
server_name hub.fqk.app;
location / { proxy_read_timeout 300; proxy_pass http://127.0.0.1:9080; proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; } }
|
管理员登录
访问 https://hub.fqk.app
1 2
| 用户名: admin 密码: [harbor.yml 中设置的 harbor_admin_password]
|
其他命令
1 2 3 4 5
| sudo docker-compose down -v
sudo docker-compose up -d
|