Docker Community Forums

Share and learn in the Docker community.

Error when I trys to set up a DNS for docker

Hello guys,

So I have a problem with DNS on the docker. I have to put it to work on a machine with CentOS 8 and with private IPs and DNS since it is for internal use, a Gitlab container and its respective runner.

The Gitlab container is working fine, but I can’t get the runner to run the jobs as he should. I already checked the gitlab-ci.yml file and there is no problem. When I put the job to run, it gives this error message, and he can’t download the dependencies to run the job, because the container that the runner creates, can’t resolve the DNS.

So I tried to set a DNS for all containers using daemon.json, but it went back to an old problem that was when jobs got stuck. I tried to make this definition through the command dockerd --dns "server ip" and it presents this error

I honestly do not know what to do because my experience with such matters and handling CentOS is low, since this is the first job I have to deal with such areas. Thanks in advance to anyone who can help me solve this problem

First, check that basic internet connectivity is working by pinging a public IP address. It should succeed, giving you output similar to this:

$ docker run busybox ping -c 1 192.203.230.10 # Ping a London-based NASA root nameserver
PING 192.203.230.10 (192.203.230.10): 56 data bytes
64 bytes from 192.203.230.10: seq=0 ttl=53 time=113.866 ms

— 192.203.230.10 ping statistics —
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 113.866/113.866/113.866 ms
But now try resolving the domain google.com:

$ docker run busybox nslookup google.com
Server: 8.8.8.8
Address 1: 8.8.8.8
nslookup: can’t resolve ‘google.com
If it fails as shown above then there is a problem resolving DNS.

1 Like

In terms of connectivity it’s all fine. I can ping from one container to another with no problem.