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

时间:2017-10-13 12:03:58

标签: 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

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

1 个答案:

答案 0 :(得分:3)

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

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