镜像下载、域名解析、时间同步请点击 阿里云开源镜像站
系统版本:CentOS Linux release 7.6.1810 (Core)
docker版本:20.10.12
docker-compose版本:v2.3.2
一、安装docker-compose:
把在百度网盘下载的docker-compose文件到服务器里
[root@zabbix 14:57:42~]# chmod +x docker-compose-linux-x86_64
[root@zabbix 14:57:48~]# mv docker-compose-linux-x86_64 /usr/local/sbin/docker-compose
二、安装harbor
1、上传在百度网盘下载的harbor压缩包文件到服务器里:
[root@zabbix 14:58:29/data/recycle]# ll
total 1237904
-rw-r--r-- 1 root root 612698835 Mar 9 14:59 harbor-offline-installer-v2.4.1.tgz
[root@zabbix 14:59:20/data/recycle]#
2、解压harbor:
[root@zabbix 14:59:20/data/recycle]# tar zxf harbor-offline-installer-v2.4.1.tgz
[root@zabbix 14:59:30/data/recycle]# ll
total 1237908
drwxr-xr-x 2 root root 4096 Mar 9 14:59 harbor
-rw-r--r-- 1 root root 612698835 Mar 9 14:59 harbor-offline-installer-v2.4.1.tgz
3、移动到部署目录:
[root@zabbix 14:59:47/data/recycle]# mv harbor /data/software/
[root@zabbix 14:59:54/data/recycle]# cd /data/software/harbor/
[root@zabbix 15:00:00/data/software/harbor]# ll
total 601612
-rw-r--r-- 1 root root 3361 Dec 16 12:22 common.sh
-rw-r--r-- 1 root root 616006217 Dec 16 12:23 harbor.v2.4.1.tar.gz
-rw-r--r-- 1 root root 8999 Dec 16 12:22 harbor.yml.tmpl
-rwxr-xr-x 1 root root 2500 Dec 16 12:22 install.sh
-rw-r--r-- 1 root root 11347 Dec 16 12:22 LICENSE
-rwxr-xr-x 1 root root 1881 Dec 16 12:22 prepare
4、修改配置文件
[root@zabbix 15:00:06/data/software/harbor]# cp harbor.yml.tmpl harbor.yml
vim harbor.yml
5、修改daemon,并添加http的通信地址,不然docker默认使用https进行通信,如果配置了https协议就不需要添加
## 如果不修改,可能会碰到如下错误,只是不一定
## [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd".
[root@zabbix 16:08:52/data/software/harbor]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://nr240upq.mirror.aliyuncs.com", "https://registry.docker-cn.com", "https://docker.mirrors.ustc.edu.cn", "https://dockerhub.azk8s.cn", "http://hub-mirror.c.163.com"],
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"insecure-registries": ["172.17.0.100:5000"]
}
[root@zabbix 16:16:59/data/software/harbor]#
改好之后,重新加载配置和重启docker
[root@zabbix 15:00:50/data/software/harbor]# systemctl daemon-reload && systemctl restart docker
6、执行部署脚本:./install.sh
[root@zabbix 15:03:56/data/software/harbor]# ./install.sh
[Step 0]: checking if docker is installed ...
Note: docker version: 20.10.12
[Step 1]: checking docker-compose is installed ...
Note: docker-compose version: 2.3.2
[Step 2]: loading Harbor images ...
1e3f0dc884e2: Loading layer [==================================================>] 39.45MB/39.45MB
3fd9ccd5eeaa: Loading layer [==================================================>] 5.275MB/5.275MB
c600bceee2f7: Loading layer [==================================================>] 4.096kB/4.096kB
724cd8711815: Loading layer [==================================================>] 3.072kB/3.072kB
d7c82a981c89: Loading layer [==================================================>] 17.32MB/17.32MB
a814341c2c44: Loading layer [==================================================>] 18.12MB/18.12MB
Loaded image: goharbor/registry-photon:v2.4.1
b00595b6932d: Loading layer [==================================================>] 5.27MB/5.27MB
e34892d856ce: Loading layer [==================================================>] 5.928MB/5.928MB
ac5a22c6047d: Loading layer [==================================================>] 14.47MB/14.47MB
3d1ac12eb215: Loading layer [==================================================>] 29.29MB/29.29MB
394b4b2ea0fa: Loading layer [==================================================>] 22.02kB/22.02kB
bb0deb7416e0: Loading layer [==================================================>] 14.47MB/14.47MB
Loaded image: goharbor/notary-signer-photon:v2.4.1
c3b02aec560c: Loading layer [==============================&