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

在dockerized gitlab-runner bash上:

Please enter the gitlab-ci coordinator URL (eg 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转发给4​​311,4312,4313)。 我应该如何设置?

当你在gitlab-ciinputhttp://localhost:4311 ,实际上localhost指的是容器内的主机。 这不是本地PC的本地localhost 。 因此, gitlab-ci无法连接到gitlab

我build议你使用docker-compose编排几个容器。