为什么我无法将 dockerized gitlab runner 连接到 dockerized gitlab ci?

kol*_*r23 3 docker gitlab-ci

在 dockerized gitlab-runner bash 上:

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://localhost:4311
Please enter the gitlab-ci token for this runner:
xxxxxxxxxxxx
Please enter the gitlab-ci description for this runner:
[runner]: dockerizedrunner
Please enter the gitlab-ci tags for this runner (comma separated):
powershell
Whether to run untagged builds [true/false]:
[false]: true
Whether to lock Runner to current project [true/false]:
[false]: false
ERROR: Registering runner... failed                 runner=xxxxxx status=couldn't execute POST against http://localhost:4364/api/v4/runners: Post http://localhost:4364/api/v4/runners: dial tcp 127.0.0.1:4311: getsockopt: connection refused
PANIC: Failed to register this runner. Perhaps you are having network problems
Run Code Online (Sandbox Code Playgroud)

我尝试了 3 个转发端口(22,80,443 转发到 4311,4312,4313)。我应该如何设置?

Buk*_*gey 5

当您输入时http://localhost:4311gitlab-ci实际上localhost是指容器内的主机。这不是localhost您本地 PC 的。因此gitlab-ci无法连接到gitlab.

我建议您使用docker-compose 来编排多个容器。