fatal: unable to access 'http://gitlab-ci-token:xxxxxx@192.168.1.13:9000/root/xxx.git/': Failed to connect to 192.168.1.13 port 9000: No route to host

We are running gitlab in docker container with port exposed: 80/tcp, 0.0.0.0:9000->9000/tcp, 0.0.0.0:9022->22/tcp, 0.0.0.0:9443->443/tcp

We followed the gitlab-runner as Docker service documentation, run gitlabr-runner in docker container as well.

As the gitlab suggested:

Specify the following URL during runner setup: http://192.168.1.13:9000/ci

We get error

Error no route to 192.168.1.13:9000

So we manually changed ip to gitlab container ip 172.17.0.2, it works. The gitlab-runner is set up properly.

When I kickoff a build. It throws the error again:

fatal: unable to access 'http://gitlab-ci-token:xxxxxx@192.168.1.13:9000/root/xxx.git/': Failed to connect to 192.168.1.13 port 9000: No route to host

192.168.1.13 is the physical server's external ip. but gitlab-runner container could not access it.