原创

Harbor安装报错502 Bad Gateway

温馨提示:
本文最后更新于 2021年12月26日,已超过 1,078 天没有更新。若文章内的图片失效(无法正常加载),请留言反馈或直接联系我

Harbor安装报错502 Bad Gateway,按照文档安装完成后,然后出现了白白的界面,瞬间赶脚不好了

Harbor安装报错502 Bad Gateway-图片1

查看容器状态发现harbor-adminserver节点一直处于Restarting状态

[root@localhost harbor]# docker-compose ps

Name Command State Ports

-----------------------------------------------------------------------------------------------------------------------------------

harbor-adminserver /harbor/start.sh Restarting

harbor-db /usr/local/bin/docker-entr ... Up 3306/tcp

harbor-jobservice /harbor/start.sh Up

harbor-log /bin/sh -c /usr/local/bin/ ... Up 127.0.0.1:1514->10514/tcp

harbor-ui /harbor/start.sh Up

nginx nginx -g daemon off; Up 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp, 0.0.0.0:80->80/tcp

registry /entrypoint.sh serve /etc/ ... Up 5000/tcp

 
 

Harbor安装报错502 Bad Gateway-图片2

 
 

查看/var/log/harbor/adminserver.log 日志有以下报错

Dec 25 02:39:18 172.18.0.1 adminserver[2641]: 2017-12-25T07:39:18Z [INFO] initializing system configurations...

Dec 25 02:39:18 172.18.0.1 adminserver[2641]: 2017-12-25T07:39:18Z [INFO] the path of json configuration storage: /etc/adminserver/config/config.json

Dec 25 02:39:18 172.18.0.1 adminserver[2641]: 2017-12-25T07:39:18Z [DEBUG] [driver_json.go:46]: path of configuration file: /etc/adminserver/config/config.json

Dec 25 02:39:18 172.18.0.1 adminserver[2641]: 2017-12-25T07:39:18Z [INFO] the path of key used by key provider: /etc/adminserver/key

 
 

查看/var/log/harbor/jobservice.log 日志有以下报错

Dec 25 02:39:50 172.18.0.1 jobservice[2641]: 2017-12-25T07:39:50Z [ERROR] [utils.go:102]: failed to connect to tcp://adminserver:8080, retry after 2 seconds :dial tcp 172.18.0.3:8

080: getsockopt: connection refused

 
 

原因是我们指定的secretkey_path 路径创建的文件没有权限

第一种方法:

设置下权限,设置目录下面secretkey文件的所属者

[root@localhost harbor]# chown 10000:10000 /mycre/secretkey

然后执行

docker-compose down

docker-compose up -d

 
 

第二种方法:

还原设置secretkey_path的路径为/data

切换harbor的安装目录执行以下操作

[root@localhost harbor]#docker-compose down

[root@localhost harbor]#rm -rf /data/secretkey

[root@localhost harbor]#./prepare

[root@localhost harbor]#docker-compose up –d

 

 

[root@localhost harbor]# docker-compose ps

Name Command State Ports

------------------------------------------------------------------------------------------------------------------------------

harbor-adminserver /harbor/start.sh Up

harbor-db /usr/local/bin/docker-entr ... Up 3306/tcp

harbor-jobservice /harbor/start.sh Up

harbor-log /bin/sh -c /usr/local/bin/ ... Up 127.0.0.1:1514->10514/tcp

harbor-ui /harbor/start.sh Up

nginx nginx -g daemon off; Up 0.0.0.0:443->443/tcp, 0.0.0.0:4443->4443/tcp, 0.0.0.0:80->80/tcp

registry /entrypoint.sh serve /etc/ ... Up 5000/tcp

[root@localhost harbor]#

 
 

正文到此结束
本文目录