关于docker:Docker-笔记-dockercompose-重启-Harbor-仓库失败的解决办法

2次阅读

共计 1970 个字符,预计需要花费 5 分钟才能阅读完成。

查看 harbor 容器的状态,目前并不是全副失常运行(Up (healthy)),此时无法访问 harbor 仓库:

[root@k8s-master harbor]# docker-compose ps
Name                     Command                   State                  Ports
harbor-core         /harbor/harbor_core              Exit 2
harbor-db           /docker-entrypoint.sh            Up (healthy)     5432/tcp
harbor-jobservice   /harbor/harbor_jobservice  ...   Up (unhealthy)
harbor-log          /bin/sh -c /usr/local/bin/ ...   Up (healthy)     127.0.0.1:1514->10514/tcp
harbor-portal       nginx -g daemon off;             Up (healthy)     8080/tcp
nginx               nginx -g daemon off;             Exit 1
redis               redis-server /etc/redis.conf     Up (healthy)     6379/tcp
registry            /home/harbor/entrypoint.sh       Up (healthy)     5000/tcp
registryctl         /home/harbor/start.sh            Up (healthy)

尝试重启 harbor 失败:

[root@k8s-master harbor]# docker-compose restart
Restarting harbor-jobservice ... done
Restarting nginx             ... done
Restarting harbor-core       ... done
Restarting redis             ... done
Restarting registry          ... error
Restarting registryctl       ... error
Restarting harbor-db         ... error
Restarting harbor-portal     ... done
Restarting harbor-log        ... done
ERROR: for registry  Cannot restart container 5e34911c8b66152bdd7492f05dec74b11ffd314d5aaedac6e8e5104808f7a098: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused
ERROR: for harbor-db  Cannot restart container 0d95056b01feb3bd66332a95170e95eec727e905ebc092b546704ed31e36117b: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused
ERROR: for registryctl  Cannot restart container 9be00e977d4f149b55dee17ebac1a9340879c3f32888aeacf89008d1f5fcb346: failed to initialize logging driver: dial tcp 127.0.0.1:1514: connect: connection refused

解决办法:

 先彻底敞开 harbor:[root@k8s-master harbor]# docker-compose stop
Stopping harbor-jobservice ... done
Stopping nginx             ... done
Stopping harbor-core       ... done
Stopping redis             ... done
Stopping harbor-portal     ... done
Stopping harbor-log        ... done

再启动 harbor 胜利:

[root@k8s-master harbor]# docker-compose start
Starting log         ... done
Starting registry    ... done
Starting registryctl ... done
Starting postgresql  ... done
Starting portal      ... done
Starting redis       ... done
Starting core        ... done
Starting jobservice  ... done
Starting proxy       ... done

起因:
harbor 各个组件的启动程序具备肯定的依赖关系,而 docker-compose restart 默认不能读取这种依赖关系(很沙雕的设定)。所以通常重启 harbor 倡议先 stop 而后再 start。

正文完
 0