Docker Community Forums

Share and learn in the Docker community.

No route to DNS server from Docker container

Problem

Even though I can successfully ping a host from a Docker container (i.e. docker run busybox ping -c 1 216.58.207.206), requests involving a DNS lookup result in a timeout (e.g. docker run nslookup google.com).

What I’ve tried

I’ve looked at suggestions from this NPM Github issue, namely editing /etc/hosts, connections from different networks, and rebooting the machine, all without any success.

Docker to Docker connection issues seem to be common (can’t include any more links due to new user link limit), however, my issue deals with Docker to DNS connection and is distinct from these issues (even though the error message is similar).

I’ve also tried Robin Winslow’s Fix Docker’s networking DNS config however, explicitly specifying the local or global DNS server fails.

Steps to replicate

$ docker run --dns <local DNS IP> busybox nslookup google.com
>>> nslookup: write to <local DNS IP>: No route to host
;; connection timed out; no servers could be reached

$ docker run --dns 8.8.8.8 busybox nslookup google.com
>>> nslookup: write to '8.8.8.8': No route to host
;; connection timed out; no servers could be reached

My system

Fedora 32 (64 bit)
Docker version 19.03.12, build 48a66213fe

Please let me know if any additional info is necessary, thank you in advance!