Search code examples
dockergitlabgitlab-ci-runnerdocker-networkgitlab-omnibus

OmniBus GitLab CE Multirunner with Docker executor cloning issues


I have installed GitLab CE on Ubuntu using the OmniBus package and the GitLab CI Multirunner with Docker executor (the docker option when configuring the Multirunner).

I ran a simple test pipeline with this .gitlab-ci.yml:

image: node
default:
  script:
  - echo okay

It gave me this error in the CI build job log:

Couldn't resolve host {computerName}

I have seen someone suggest adding extra_hosts = ["{computerName}:127.0.0.1"] to /etc/gitlab-runner/config.toml under [runner.docker] at that made that error go away.

Now I am getting this error:

Unable to access 'http://gitlab-ci-token:{ciToken}:{computerName}/root/test.git/': Failed to connect to {computerName} port 80: Connection refused.

I have seen a suggestion to change external_url, but I am not sure what to. Currently it says {computerName} as everywhere else. The runner is trying to access that at port 80, everything as I'd it expect to be.

I am thinking maybe that 80 working for me in Firefox and Git but not in the runner means it attempts to connect to 80 within the Docker network which fails because the service is in the host network. This idea is further reinforced by the fact that when taking http://gitlab-ci-token:{ciToken}:{computerName}/root/test.git/ and pasting it into the browser, I land on the repository page in my GitLab instance.

I don't know what to change external_url to so it works with Git clone within the Docker container. How can I network the two together?

For reference, I have also linked this question in a new topic on GitLab Forum and if an answer is found, I'll ask the author to answer on SO as well so I can close this SO question.


Solution

  • The extra_hosts = line should add a hosts entry for the IP that your gitlab server is reachable at from inside your docker container, so probably not 127.0.0.1.

    In the case of running docker on the same machine as your gitlab, this is the ip assigned to your docker0 interface, for instance 172.17.0.1.