解决 Harbor 启动失败故障
发布于: 2020 年 07 月 22 日
现象
使用 docker-compose 启动的 Harbor。
重启 docker 后,Harbor 无法正常重启。
# 重启 Dockersystemctl restart docker# 查看状态docker-compose ps Name Command State Ports --------------------------------------------------------------------------harbor-core /harbor/harbor_core Up harbor-db /docker-entrypoint.sh Up 5432/tcpharbor-jobservice /harbor/harbor_jobservice ... Up harbor-log /bin/sh -c /usr/local/bin/ ... Restarting harbor-portal nginx -g daemon off; Up 8080/tcpnginx nginx -g daemon off; Restarting redis redis-server /etc/redis.conf Up 6379/tcpregistry /home/harbor/entrypoint.sh Exit 137 registryctl /home/harbor/start.sh Up # 关闭 harborocker-compose down -vStopping harbor-jobservice ... Stopping nginx ... Stopping harbor-core ... Stopping harbor-db ... Stopping registryctl ... Stopping redis ... Stopping harbor-portal ... Stopping harbor-log ... Removing harbor-jobservice ... Removing nginx ... Removing harbor-core ... Removing harbor-db ... Removing registryctl ... Removing redis ... Removing registry ... Removing harbor-portal ... Removing harbor-log ... Removing network harbor_harbor# 启动 harbordocker-compose up -dCreating network "harbor_harbor" with the default driverCreating harbor-log ... Creating harbor-portal ... Creating redis ... Creating harbor-db ... Creating registryctl ... Creating registry ... ERROR: for harbor-portal Cannot start service portal: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refusedERROR: for redis Cannot start service redis: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refusedERROR: for harbor-db Cannot start service postgresql: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refusedERROR: for registryctl Cannot start service registryctl: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refusedERROR: for portal Cannot start service portal: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refusedERROR: for redis Cannot start service redis: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refusedERROR: for postgresql Cannot start service postgresql: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refusedERROR: for registryctl Cannot start service registryctl: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refusedERROR: Encountered errors while bringing up the project.
分析
查看日志
docker-compose logs logAttaching to harbor-logharbor-log | sudo: Account or password is expired, reset your password and try againharbor-log | Changing password for root.harbor-log | sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helperharbor-log | sudo: unable to change expired password: Authentication token manipulation error...
解决
mkdir -p /tmp/harbor-logcd /tmp/harbor-logdocker export harbor-log -o harbor-log.tartar xvfp harbor-log.tarsed -i 's/:90:/:99999:/g' /tmp/harbor-log/etc/shadowmkdir -p /opt/harbor-log-etc/cp /tmp/harbor-log/etc/shadow /opt/harbor-log-etc/shadow
修改 docker-compose.yaml
- type: bind source: /opt/harbor-log-etc/shadow target: /etc/shadow
重启
docker-compose downdocker-compose up -d
参考
https://github.com/goharbor/harbor/issues/11633
划线
评论
复制
发布于: 2020 年 07 月 22 日阅读数: 634
版权声明: 本文为 InfoQ 作者【FeiLong】的原创文章。
原文链接:【http://xie.infoq.cn/article/07b3a4de1062852e23395b19e】。
本文遵守【CC-BY 4.0】协议,转载请保留原文出处及本版权声明。
FeiLong
关注
还未添加个人签名 2018.09.17 加入
还未添加个人简介
评论