无法在本地网络服务器上注册 git runner

Fad*_*adi 5 linux git ubuntu gitlab server

我正在尝试在我公司的本地网络服务器上注册一个 git runner,gitlab 使用自签名证书可以正常工作,但是在尝试注册这样的 git runner 时

sudo gitlab-runner register --tls-ca-file=/home/gitlab-runner/certs/git.crt
Run Code Online (Sandbox Code Playgroud)

然后粘贴git URL

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/)
https://git.mycompany/
Run Code Online (Sandbox Code Playgroud)

然后是令牌:

Please enter the gitlab-ci token for this runner: 
TOKEN
Run Code Online (Sandbox Code Playgroud)

然后是描述和标签,然后我收到此错误:

ERROR: Registering runner... failed   
runner=TOKEN status=couldn't execute POST against https://git.mycompany/api/v4/runners:
Post https://git.mycompany/api/v4/runners: 
dial tcp: lookup git.mycompany on 127.0.0.53:53: 
no such host
PANIC: Failed to register this runner. Perhaps you are having network problems
Run Code Online (Sandbox Code Playgroud)

我没有使用 docker,只是正常设置,请提前提供任何帮助和非常感谢

在此处输入图片说明

更新:

我将 DNS 服务器的名称服务器添加到 /etc/resolv.conf 并且最后一个错误消失了,但我有新错误:

 x509: certificate has expired or is not yet valid
Run Code Online (Sandbox Code Playgroud)

即使我正在将 .crt 注册为文档和

sudo gitlab-runner register --tls-ca-file /path/to/some-host-gitlab.com.crt
Run Code Online (Sandbox Code Playgroud)

这是自签名证书

在此处输入图片说明

更新

2019 年 6 月 5 日至 2019 年 7 月 5 日有效的证书是否是自签名证书很重要?

在此处输入图片说明

Cod*_*rji 5

关于DNS问题,您必须更改DNS服务器并将/etc/resolv.conf您的DNS设置nameserver为您的DNS。

对于证书,Gitlab 运行程序默认检查系统证书存储并根据系统中存储的 CA 验证 Gitlab 服务器。要将您的证书添加到系统中,您应该将受信任的证书添加到/usr/local/share/ca-certificates/并执行sudo update-ca-certificates. --tls-ca-file或者您可以在注册运行器时将证书设置为参数。

我建议创建一个具有更多验证天数的新证书。(不要忘记更改 apache2 或 ngix 中 gitlab 配置中的证书路径。