场景架构:属于分布式集群的方式部署Dokcer镜像仓库,每个项目部署一个从仓库,所有从仓库共用连接一个主仓库,每次对镜像构建集成时将PUSH至主仓库,主仓库再分发至各项目的从仓库。

部署Harbor

目录结构:

1
2
3
sudo mkdir /home/nucleus-oc/
sudo mkdir /home/nucleus-oc/harbor/ # 数据目录
sudo mkdir /home/nucleus-oc/2231/ # 控制目录

SSL证书

1
2
/home/nucleus-oc/harbor/ssl-key/chained.pem #证书
/home/nucleus-oc/harbor/ssl-key/server.key # 密钥

下载并解压缩离线安装包:

1
2
3
cd /home/nucleus-oc/2231/
wget https://github.com/vmware/harbor/releases/download/v1.1.2/harbor-offline-installer-v1.1.2.tgz
tar xf harbor-offline-installer-v1.1.2.tgz

修改配置文件docker-compose.yml

1
2
3
4
cd /home/nucleus-oc/2231/harbor/
sed -e 's@ /data/@ /home/nucleus-oc/harbor/@' \
-e 's@ /var/log/harbor/@ /home/nucleus-oc/harbor/logs/@' \
-i docker-compose.yml

修改harbor.cfg

1
2
3
4
5
6
7
8
9
5 hostname = oc-control-h9tc.mtiancity.com      #仓库域名 
9 ui_url_protocol = https
12 db_password = wV6QRnTkX8SQNqxu
24 ssl_cert = /home/nucleus-oc/harbor/ssl-key/chained.pem
25 ssl_cert_key = /home/nucleus-oc/harbor/ssl-key/server.key
28 secretkey_path = /home/nucleus-oc/harbor
55 harbor_admin_password = GLcvN2Ezrh5XT3Hx
87 self_registration = off
95 project_creation_restriction = adminonly

正式安装

1
2
cd /home/nucleus-oc/2231/harbor/
./install.sh

解析域名

参考资料