我已经在 Vagrant VM 上设置了 Gitlab 服务器。当我尝试注册时
sudo docker exec -t -i gitlab-runner gitlab-runner register
我有问题
ERROR: Registering runner... failed runner=https:// status=couldn't execute POST against https://gitlab-miki/api/v4/runners: Post https://gitlab-miki/api/v4/runners: dial tcp: lookup gitlab-miki on 10.0.2.3:53: server misbehaving
我的 IP 实际上是inet 10.10.1.79
ip addr show
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:6d:95:c4 brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic eth0
valid_lft 81734sec preferred_lft 81734sec
inet6 fe80::a00:27ff:fe6d:95c4/64 scope link
valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 08:00:27:de:34:e3 brd ff:ff:ff:ff:ff:ff
inet 10.10.1.79/24 brd 10.10.1.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fede:34e3/64 scope link
valid_lft forever preferred_lft forever
为何服务器行为异常?
答案1
我遇到了类似的问题/错误消息,似乎说找不到 gitlab 服务器。
ERROR: Registering runner... failed
runner=XXXX status=couldn't execute POST against http://YYYY/api/v4/runners: Post "http://YYYY/api/v4/runners": dial tcp: lookup YYYY on 192.168.Z.Z:53: server misbehaving
PANIC: Failed to register the runner.
尽管我在 GitLab Runner 框的 /etc/hosts 文件中定义了 GitLab 服务器主机名(在您的情况下为 gitlab-miki),但由于某种原因无法解析。
(在 GitLab 服务器上的设置->CI/CD->Runners->Specific runners->2. 使用此 URL 注册运行器,它显示的是服务器主机名的地址,而不是 IP 地址)
我通过在注册过程中用 GitLab 服务器的 IP 替换主机名(gitlab-miki)解决了这个问题。