Im using 2 containers on my Ubuntu OS: Gitlab-ce and gitlab-runner
Containers names are: gitlab_gitlab_1 and gitlab_gitlab-runner_1
I
In case this helps others looking for this..
Same problem but GitLab and GitLab Runner run on different machines in LAN. DNS is working and ping gitlab works, except inside dockers:
$ sudo docker run -it alpine ping gitlab
ping: bad address 'gitlab'
^C
But works with DNS given:
$ sudo docker run -it --dns=172.168.0.1 alpine ping gitlab
PING gitlab (172.168.0.5): 56 data bytes
64 bytes from 172.168.0.5: seq=0 ttl=63 time=0.536 ms
^C
Edit /etc/docker/daemon.json on the GitLab Runner (file did not exist yet) with contents:
{
"dns": ["172.168.0.1", "1.1.1.1"]
}
Test again, now OK:
$ sudo docker run -it --dns=172.168.0.1 alpine ping gitlab
PING gitlab (172.168.0.5): 56 data bytes
64 bytes from 172.168.0.5: seq=0 ttl=63 time=0.455 ms
64 bytes from 172.168.0.5: seq=1 ttl=63 time=0.905 ms
^C
If this is not how its supposed to be done, i'd be happy to hear.
If this problem shouldnt aught to exist in the first place, i'd be happy to hear as well. I was surprised to not find much references online to this problem for GitLab Runner..