3

Harbor故障篇:服务启动失败问题处理记录

 1 year ago
source link: https://blog.51cto.com/lidabai/5358624
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

👨🏻‍🎓博主介绍:大家好!我是李大白,一名运维容器运维工程师,热爱分享知识🌟 

🌈擅长领域:云原生、数据库、自动化运维

🙏🏻如果本文章对小伙伴们有帮助的话,🍭关注+👍🏻点赞+🗣评论+📦收藏!

🤝如果在文章描述时如有错,恳请各位大佬指正,在此感谢!!!

🍂 落叶而知秋,博闻而强识!

📕  精品专栏:​ ​Harbor大白话(企业级)​


一、问题描述

启动Harbor服务时报错:

[root@test-docker-man-01 harbor]# docker-compose up -d
Pulling log (goharbor/harbor-log:v1.8.6)...
ERROR: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:47105->[::1]:53: read: connection refused

Harbor故障篇:服务启动失败问题处理记录_运维

二、问题处理过程

2.1 在 /etc/resolv.conf中添加

[root@test-docker-man-01 ~]# cat /etc/resolv.conf
nameserver 8.8.8.8

然后查看harbor服务状态:

[root@test-docker-man-01 harbor]# docker-compose down
ERROR: 2 matches found based on name: network harbor_harbor is ambiguous

Harbor故障篇:服务启动失败问题处理记录_kubernetes_02

好吧!又产生新的报错了。继续排查,看这报错是docker网络问题,那就先查看docker的网络。

2.2 查看docker网络

[root@test-docker-man-01 harbor]# docker network ls
NETWORK ID NAME DRIVER SCOPE
c89422768519 bridge bridge local
05f23ebdbbd8 harbor_harbor bridge local
6bc85eb71c09 harbor_harbor bridge local
6ac13f60d042 harbor_harbor-chartmuseum bridge local
d46c3c90e490 harbor_harbor-chartmuseum bridge local
9ab30c134793 host host local
e756da2d0b14 none null local
Harbor故障篇:服务启动失败问题处理记录_运维_03

可以看到harbor_harbor和harbor_harbor-chartmuseum都重复了,这导致docker网络冲突了,删掉重复中的一个。

2.3 删除docker重复的网络

[root@test-docker-man-01 harbor]# docker network rm 05f23ebdbbd8
05f23ebdbbd8
[root@test-docker-man-01 harbor]# docker network rm 6ac13f60d042
6ac13f60d042

再查看dockers网络:

[root@test-docker-man-01 harbor]# docker network ls
NETWORK ID NAME DRIVER SCOPE
50d2b9266d06 bridge bridge local
6bc85eb71c09 harbor_harbor bridge local
d46c3c90e490 harbor_harbor-chartmuseum bridge local
9ab30c134793 host host local
e756da2d0b14 none null local
Harbor故障篇:服务启动失败问题处理记录_运维_04

2.4 重启docker服务

[root@test-docker-man-01 harbor]# systemctl restart docker
[root@test-docker-man-01 harbor]# systemctl status docker
Harbor故障篇:服务启动失败问题处理记录_Harbor_05

docker服务正常!

2.4 查看Harbor服务状态

再看harbor服务是否有异常。

[root@test-docker-man-01 harbor]# docker-compose ps
Name Command State Ports
------------------------------------------------------------------------------------------------------
chartmuseum /docker-entrypoint.sh Exit 137
harbor-core /harbor/start.sh Up (health: starting)
harbor-db /entrypoint.sh postgres Exit 255
harbor-jobservice /harbor/start.sh Up
harbor-log /bin/sh -c /usr/local/bin/ ... Up (healthy) 127.0.0.1:1514->10514/tcp
harbor-portal nginx -g daemon off; Exit 128
nginx nginx -g daemon off; Exit 128
redis docker-entrypoint.sh redis ... Up 6379/tcp
registry /entrypoint.sh /etc/regist ... Exit 137
registryctl /harbor/start.sh Exit 137
Harbor故障篇:服务启动失败问题处理记录_kubernetes_06

可以看到harbor有几个组件的服务处于Exit退出异常状态。接下来重启harbor服务下!

2.5 重启Harbor服务

  • 停止Harbor
[root@test-docker-man-01 harbor]# docker-compose down
Stopping harbor-jobservice ... done
Stopping harbor-core ... done
Stopping redis ... done
Stopping harbor-log ... done
Removing nginx ... done
Removing harbor-portal ... done
Removing harbor-jobservice ... done
Removing chartmuseum ... done
Removing harbor-core ... done
Removing registryctl ... done
Removing harbor-db ... done
Removing redis ... done
Removing registry ... done
Removing harbor-log ... done
Removing network harbor_harbor
Removing network harbor_harbor-chartmuseum
Harbor故障篇:服务启动失败问题处理记录_运维_07
  • 启动Harbor
[root@test-docker-man-01 harbor]# docker-compose up -d
Creating network "harbor_harbor" with the default driver
Creating network "harbor_harbor-chartmuseum" with the default driver
Creating harbor-log ... done
Creating redis ... done
Creating registry ... done
Creating registryctl ... done
Creating harbor-db ... done
Creating harbor-core ... done
Creating chartmuseum ... done
Creating harbor-portal ... done
Creating harbor-jobservice ... done
Creating nginx ... done
Harbor故障篇:服务启动失败问题处理记录_云原生_08
  • 查看harbor服务
[root@test-docker-man-01 harbor]# docker-compose ps
Name Command State Ports
---------------------------------------------------------------------------------------------
chartmuseum /docker-entrypoint.sh Up (healthy) 9999/tcp
harbor-core /harbor/start.sh Up (healthy)
harbor-db /entrypoint.sh postgres Up (healthy) 5432/tcp
harbor-jobservice /harbor/start.sh Up
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) 80/tcp
nginx nginx -g daemon off; Up (healthy) 0.0.0.0:8021->80/tcp
redis docker-entrypoint.sh redis ... Up 6379/tcp
registry /entrypoint.sh /etc/regist ... Up (healthy) 5000/tcp
registryctl /harbor/start.sh Up (healthy)
Harbor故障篇:服务启动失败问题处理记录_kubernetes_09

harbor服务正常!问题解决。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK