Docker Community Forums

Share and learn in the Docker community.

Problem resolving DNS on docker container even though DNS server is reachable


(Shaharhoch) #1

Hi,
I’m having a problem resolving DNS on my docker container, even though the DNS server is reachable.

I try to look up google.com using nslookup and I fail:

sudo docker run busybox nslookup google.com
nslookup: can't resolve 'google.com'
Server:    8.8.8.8
Address 1: 8.8.8.8

I see that the DNS server used by the container is 8.8.8.8, so I try to ping it and it is reachable:

sudo docker run busybox ping 8.8.8.8 -c 4
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: seq=0 ttl=127 time=151.495 ms
64 bytes from 8.8.8.8: seq=1 ttl=127 time=150.644 ms
64 bytes from 8.8.8.8: seq=2 ttl=127 time=149.766 ms
64 bytes from 8.8.8.8: seq=3 ttl=127 time=151.873 ms

--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 149.766/150.944/151.873 ms

This means the container has internet access and it can reach the Google DNS server, but for some reason it cannot resolve any address.

Can anyone help me figure out why?

Thanks.