kol23
kol23

Reputation: 1598

Why I can't connect dockerized gitlab runner to a dockerized gitlab ci?

On a 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

I tried this with 3 forwarded ports (22,80,443 forwarded to 4311,4312,4313). How should I set it up?

Upvotes: 3

Views: 1972

Answers (1)

Bukharov Sergey
Bukharov Sergey

Reputation: 10225

When you type http://localhost:4311 in gitlab-ci actually localhost refers to host inside container. This is not localhost of your local PC. Therefore gitlab-ci could not connect to gitlab.

I recommend you to use docker-compose to orchestrate several containers.

Upvotes: 5

Related Questions