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 (on any kind of base container such as ubuntu os centOS) i get the correct answer but when I try running ping 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

ang I’m getting this (correct) output:

[server@localhost ~]$ docker run busybox ping -c 1
PING ( 56 data bytes
64 bytes from seq=0 ttl=51 time=32.413 ms
--- 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 with the command:

docker run busybox nslookup

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