Skip to content

Networking Issue: Cannot Resolve GitLab Host

In a similar vein to #305 (closed) and #977 (closed), my docker-hosted builds fail with a "Couldn't resovle host" error when trying to clone the project repository.

gitlab-ci-multi-runner 1.0.1 (cffb5c7)
Using Docker executor with image ruby:latest ...
Pulling docker image postgres:latest ...
Starting service postgres:latest ...
Waiting for services to be up and running...
Pulling docker image ruby:latest ...

Running on runner-899643d3-project-39-concurrent-0 via debian...
Cloning repository...
Cloning into '/builds/tmm/hook-testing'...
fatal: unable to access 'http://gitlab-ci-token:xxxxxx@_HOST_/tmm/hook-testing.git/': Couldn't resolve host '_HOST_'

ERROR: Build failed with: exit code 1

However, if I start up the docker container myself and run git clone inside it, it works fine.

This is how I start the gitlab-runner container:

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

then

docker exec -it gitlab-runner bash

my .gitlab-ci.yml

image: ruby:latest
test:
  tags:
    - linux
  script:
    - ping _HOST_

I am at a bit of a loss here, does gitlab-ci-multi-runner do something differently when it starts up the docker container? And if so, how can I see what that is?

I've started the runner daemon in the foreground with debugging and verbose logging, but it hasn't really shed any light on the matter:

gitlab-ci-multi-runner -l debug --debug run