Gitlab-runner from Docker container hanging in register process

Hello,

I’m trying to run a gitlab-runner inside of a docker container. I’ve been following the gitlab-ci get started docs, and here is how i’ve installed the image:

https://docs.gitlab.com/runner/install/docker.html

docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest

I’ve started the runner using:

docker exec gitlab-runner gitlab-runner start

Then I start the registration process using:

docker exec gitlab-runner gitlab-runner register

And after I input the gitlab URL on the first prompt it seems to hang with no further output:

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://jonathan-virtualbox/

I am hosting gitlab locally in a virtual machine. On that same virtual machine I am running the dockerized runner.

Does this resolve to an IP address? Have you correctly configured your Virtualbox network?

I think so although my experience with networking is very low so I’m not so good when it comes to network configuration. But my /etc/hosts file says

127.0.0.1	localhost
127.0.1.1	jonathan-VirtualBox

And I can visit ‘http://jonathan-VirtualBox’ in a browser and it will take me to the gitlab instance

While the Docker container will use its host’s /etc/hosts for DNS resolution, 127.0.1.1 is a loopback address - I suspect this means the Docker container is trying to connect to itself, not the host’s processes.

The host should have an IP address similar to 10.0.2.* (check with ip a) - try adding that to the host’s /etc/hosts instead of 127.0.1.1, e.g.

10.0.2.1 jonathan-virtualbox
1 Like

from ip a i found enp0s3: with an ip of 10.0.2.15, i added this to my etc hosts file:

127.0.0.1	localhost
10.0.2.15	jonathan-VirtualBox

but the hanging behaviour remains the same. I can still visit gitlab in the browser and its using the new ip.

Same problem. And I’m sure the GitLab host is reachable.
Regards,
Luiz