I have the latest docker image of GitLab running in a test environment and I\'m running into an issue with the GitLab runner. It\'s unable to clone via the HTTP link, yieldi
As for now (latest versions of gitlab - 9 and upwards) you need to use https with proper ssl certificate.
As soon you add new runner with https://... all should work just fine.
I know this question is pretty old, but you can use slightly different approach (in case you are using docker runner with the same problem).
Run Gitlab under a domain name - it may be totally virtual, just make sure that all your VMs can resolve the domain name.
Then modify /etc/gitlab-runner/config.toml and add extra_hosts
variable to the [runners.docker]
section with value ["your_domain_name:ip_address"]
. You can also add any other hosts you may need.
You can find more info on runner config at https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/docs/configuration/advanced-configuration.md
I hypothesized the issue might have something to do with registering the runner as a docker container causing the localhost address not to resolve to the right machine (where I'm starting the runner); in this case it probably resolves to the container instead. Using the host's IP on the docker proxy interface (172.17.0.1 for me) or using the host's real address instead of "localhost" when registering the runner fixes the problem.
Edit: Here is a bit more detail on the problem as I understand it and a solution. The docker instance that's loaded up is like a (very) lightweight virtual machine. Docker configures a virtual network interface which you'll see if you run ifconfig from your host machine:
user@pc:~> ifconfig
docker0 Link encap:Ethernet HWaddr XXXX
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
...
This is the IP address of the host machine on that interface. So, if you want the runner to be able to connect to the service that's running on that host machine, you can't point it to localhost/127.0.0.1 because, coming from inside the runner's instance, that will route to the runner's "VM", but GitLab is not running inside that runner "VM", it's on the host, so the runner is unable to communicate with GitLab.
The solution is to register the runner to point to the host's virtual address on the docker interface (http://172.17.0.1/ci for me), or to use the host's public IP or a domain name if you have one and it's accessible publicly. Just don't send it to localhost or 127.0.0.1 because, to the runner, that points to its "VM", not your GitLab instance.