- 1、下载软件二进制包并解压
- 1、cd opt
- 2、mkdir src
- 3、cd src
- 4、获取镜像
- 5、解压到opt目录下:tar xf harbor-offline-installer-v2.3.0.tgz -C /opt/
- 6、返回opt目录
- 7、重命名harbor为harbor-v2.3.0:mv harbor/ harbor-v2.3.0
- 8、短文件名:ln -s /opt/harbor-v2.3.0/ /opt/harbor
- 9、修改harbor.yml文件
- 10、创建文件夹:mkdir -p /data/harbor/logs
- 11、因为harbor依赖docker运行,所以需要安装docker-compose:yum install docker-compose
- 12、查看docker-compose版本:rpm -qa docker-compose
- 13、执行install.sh文件:./install.sh(确定docker是否启动)
- 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
1、下载软件二进制包并解压
harbor github地址:https://github.com/goharbor/harbor
1、cd opt
2、mkdir src
3、cd src
4、获取镜像
wget https://github.com/goharbor/harbor/releases/download/v2.3.0/harbor-offline-installer-v2.3.0.tgz
或国内镜像
wget https://storage.googleapis.com/harbor-releases/release-2.3.0/harbor-offline-installer-v2.3.0.tgz
5、解压到opt目录下:tar xf harbor-offline-installer-v2.3.0.tgz -C /opt/
6、返回opt目录
7、重命名harbor为harbor-v2.3.0:mv harbor/ harbor-v2.3.0
8、短文件名:ln -s /opt/harbor-v2.3.0/ /opt/harbor
9、修改harbor.yml文件
hostname:harbor.jack.com
port:180
data_volime:/data/harbor
location:/data/harbor/logs
10、创建文件夹:mkdir -p /data/harbor/logs
11、因为harbor依赖docker运行,所以需要安装docker-compose:yum install docker-compose
12、查看docker-compose版本:rpm -qa docker-compose
13、执行install.sh文件:./install.sh(确定docker是否启动)
坑1:
报错:
prepare base dir is set to /opt/harbor-v2.3.0Error happened in config validation…
ERROR:root:Error: The protocol is https but attribute ssl_cert is not set
解决方案:
原因是harbor.yml中默认是配置https的端口及证书路径的。解决办法是把这些配置都注释掉。
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
原文链接:https://blog.csdn.net/m0_50207724/article/details/108278475
14、安装nginx:yum install nginx
设置配置文件:/etc/nginx/conf.d/harbor.jack.com.conf
server{
listen 80;
server_name harbor.jack.com;
client_max_body_size 1024m;
location / {
proxy_pass http://127.0.0.1:180;
}
}
15、执行:nginx -t
16、执行:systemctl start nginx && systemctl enable nginx
17、在10.4.7.11上:vi /var/named/jack.com.zone
RIGIN jack.com.$TTL 600 ; 10 minutes
@ IN SOA dns.jack.com. dnsadmin.jack.com. (
2021070402 ; serial
10800 ; refresh (3 hours)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS dns.jack.com.
$TTL 60 ; 1 minute
dns A 10.4.7.11
harbor A 10.4.7.200
注意:每次前滚一个序列号:2021070402 ; serial
执行:systemctl restart named
dig -t A harbor.jack.com +short
输出:
10.4.7.200
18、在10.4.7.200上执行curl harbor.jack.com
输出:
<!doctype html>
Loading…
19、下载nginx镜像:
docker pull nginx:1.12.2
查看所有镜像:docker images
输出:
REPOSITORY TAG IMAGE ID CREATED SIZEgoharbor/harbor-exporter v2.3.0 fa4ecf260b3a 2 weeks ago 80.7MB
goharbor/chartmuseum-photon v2.3.0 199be7eb1b5b 2 weeks ago 178MB
goharbor/redis-photon v2.3.0 3cc2c3e315a2 2 weeks ago 191MB
goharbor/trivy-adapter-photon v2.3.0 3c3dc5fc0529 2 weeks ago 164MB
goharbor/notary-server-photon v2.3.0 a8e3a26ef25a 2 weeks ago 105MB
goharbor/notary-signer-photon v2.3.0 e8776cc92436 2 weeks ago 102MB
goharbor/harbor-registryctl v2.3.0 4cf0d9bc3086 2 weeks ago 132MB
goharbor/registry-photon v2.3.0 222f05a9ab07 2 weeks ago 81MB
goharbor/nginx-photon v2.3.0 78f6ae7adc04 2 weeks ago 44MB
goharbor/harbor-log v2.3.0 9446a5b39706 2 weeks ago 194MB
goharbor/harbor-jobservice v2.3.0 bac328ac1a47 2 weeks ago 170MB
goharbor/harbor-core v2.3.0 7bbebce7798c 2 weeks ago 157MB
goharbor/harbor-portal v2.3.0 c4f22964cbf3 2 weeks ago 57.3MB
goharbor/harbor-db v2.3.0 fc74663d9e30 2 weeks ago 262MB
goharbor/prepare v2.3.0 a830321ca695 2 weeks ago 291MB
nginx 1.12.2 4037a5562b03 3 years ago 108MB
20、给nginx镜像打标签: docker tag 4037a5562b03 harbor.jack.com/public/nginx:v1.22.2
21、推送nginx到harbor仓库:
1、docker login harbor.jack.com 输入用户名和密码
2、docker push harbor.jack.com/pubic/nginx:v1.22.2
harbor 502错误解决:
docker ps -a查看harbor状态
输出:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7110d1fabb5b goharbor/harbor-jobservice:v2.3.0 “/harbor/entrypoint.…” 6 days ago Up 20 seconds (health: starting) harbor-jobservice
1b393a8139f2 goharbor/nginx-photon:v2.3.0 “nginx -g ‘daemon of…” 6 days ago Restarting (1) 23 seconds ago nginx
81b7ece8e57c goharbor/harbor-core:v2.3.0 “/harbor/entrypoint.…” 6 days ago Exited (255) 6 minutes ago harbor-core
114455a336dc goharbor/redis-photon:v2.3.0 “redis-server /etc/r…” 6 days ago Exited (255) 6 minutes ago redis
b9a52400490d goharbor/harbor-db:v2.3.0 “/docker-entrypoint.…” 6 days ago Up 6 minutes (healthy) harbor-db
a79d9cb11b37 goharbor/harbor-registryctl:v2.3.0 “/home/harbor/start.…” 6 days ago Exited (255) 6 minutes ago registryctl
f8c496a12b54 goharbor/harbor-portal:v2.3.0 “nginx -g ‘daemon of…” 6 days ago Exited (255) 6 minutes ago harbor-portal
07fbd1fc3fc9 goharbor/registry-photon:v2.3.0 “/home/harbor/entryp…” 6 days ago Up 6 minutes (healthy) registry
59a46ad90ba0 goharbor/harbor-log:v2.3.0 “/bin/sh -c /usr/loc…” 6 days ago Up 6 minutes (healthy) 127.0.0.1:1514->10514/tcp harbor-log
0cf1e45c01b6 nginx “/docker-entrypoint.…” 6 days ago Exited (255) 6 days ago 80/tcp focused_jang
cba1cb643ff3 webapp_v1.0.0 “dotnet WebApp.dll” 3 weeks ago Exited (255) 6 days ago 0.0.0.0:8090->8080/tcp, :::8090->8080/tcp mywebapp
查看日志没有报错:
[root@hdss7-200 logs]# tail -fn 200 registry.log
[root@hdss7-200 harbor]# docker-compose stop
Stopping harbor-jobservice … done
Stopping nginx … done
Stopping harbor-db … done
Stopping registry … done
Stopping harbor-log … done
[root@hdss7-200 harbor]# docker-compose up -d
Starting harbor-log … done
Starting harbor-portal …
Starting registryctl …
Starting registry …
Starting redis …
Starting redis … done
Starting harbor-core … done
Starting harbor-jobservice …
Starting harbor-jobservice … done
