Docker Community Forums

Share and learn in the Docker community.

Containers cannot resolve DNS

I just installed docker on CentOS 8. Everything went fine, I’ve run the hello_world test container and the result was successful.
The issue is that inside the containers I cannot resolve any DNS queries. For example when I type ping 8.8.8.8 (on any kind of base container such as ubuntu os centOS) i get the correct answer but when I try running ping google.com I don’t get any answer, meaning that the container is unable to resolve the DNS for any URL.
I’ve also tried running a base container like this:

docker run busybox ping -c 1 192.203.230.10

ang I’m getting this (correct) output:

[server@localhost ~]$ docker run busybox ping -c 1 192.203.230.10
PING 192.203.230.10 (192.203.230.10): 56 data bytes
64 bytes from 192.203.230.10: seq=0 ttl=51 time=32.413 ms
--- 192.203.230.10 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 32.413/32.413/32.413 ms

But now trying resolving the domain google.com with the command:

docker run busybox nslookup google.com

I get this output:
Schermata 2020-05-02 alle 15.32.55 :
I’m finding this problem really frustrating since I’ve not found a way to solve it, so please help me :sweat_smile:
Tell me which command to run to get any info you’d find useful to help me solve this issue, I’ll post it here asap.

Please try with userdefined bridge, as default bridge doesnt support DNS resolution atleast for container names