Skip to content

Docs feedback: Troubleshooting Runner problems inside docker

New doc or update?

  • New documentation
  • Update existing documentation

Issue

When installing the GitLab Runner, there was some problems regarding the runner being unable to connect to the GitLab service, saying that the Host is unreachable or no route to host.

My setup was simple: one server running Docker, with gitlab-ce as a container (having all the services forwarded to the host). All my attempts to get a GitLab Runner working were in vain, either in the registration process or when running the actual CI job - in one way or another - not being able to connect to GitLab.

"Gotcha"

The real problem (IMO) with my setup is that I was trying to run the GitLab Runner in the same server that GitLab was running, even though all of them were inside docker containers. I was prompted by another GitLab forums user to try and run the Runner in another machine, which actually worked flawlessly.

So, reading the documentation again and again and again, I found that information to install the runner "on a server separate than where GitLab is installed on" (here), although I found that information very subtle and (I don't know if I'm right) not straightforward to say that the runner, inside docker or not, really needs to run on another server. If this is the case, then I strongly suggest to add this information as troubleshooting and be very incisive as where the runner REALLY needs to run.

Troubleshooting ideas

Some of the ideas I have for troubleshooting are:

  • Connection problems inside the job, such as fatal: unable to access ‘http(s)://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@gitlab.example.com/project/project.git/’: Failed to connect to gitlab.example.com port 80|443: Host is unreachable;
  • Connection problems when registering the runner:
    $ docker run -d --name gitlab-runner -v /srv/gitlab-runner/config:/etc/gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
    49d45407a487056db8a2afb60dd8be069c67ed860c00c21e23be5763a51b233b
    
    $ docker exec -it gitlab-runner gitlab-runner register
    Runtime platform                                    arch=amd64 os=linux pid=14 revision=8bb608ff version=11.7.0
    Running in system-mode.                            
                                                       
    Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
    https://gitlab.example.com/
    Please enter the gitlab-ci token for this runner:
    xxxxxxxxxxxxxxxxxxxx
    Please enter the gitlab-ci description for this runner:
    [49d45407a487]: 
    Please enter the gitlab-ci tags for this runner (comma separated):
    wrong, runner
    ERROR: Registering runner... failed                 runner=xxxxxxxx status=couldn't execute POST against https://gitlab.example.com/api/v4/runners: Post https://gitlab.example.com/api/v4/runners: dial tcp xxx.xxx.xxx.xxx:443: getsockopt: no route to host
    PANIC: Failed to register this runner. Perhaps you are having network problems

References

Credits

All credits to forum user @rsvargas for the idea that ultimately made me realize what was going on. Thanks for your time and sorry if I couldn't strictly follow your documentation guidelines from the template.

Edited by Richard Gerd Kuesters