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

Why I can't connect dockerized gitlab runner to a dockerized 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

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

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

我推荐你使用docker-compose来编排多个容器。