2

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).

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, 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.

$ 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

Armin
  • 41
  • 1
  • 6
  • 1
    Docker environments can be so different that without providing additional information like: Docker version, Operating System, its difficult to help. – João Alves Jun 29 '20 at 17:58
  • 1
    I provided the particular Docker container used (busybox). My docker version is 19.03.12 and I'm using Fedora 32 64 bit version. – Armin Jun 29 '20 at 18:12

1 Answers1

2

Quick Fix

For anyone else having Fedora 31/32 Docker issues I suggest following the Fedora Magazine's Guide on Docker and Fedora 32

For me personally the issue was caused by the firewall blocking docker connections and the following command fixed it:

sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0
sudo firewall-cmd --reload # reload the firewall rules

Moving to Podman

Docker requires a root daemon, which creates a security concern. The issue can be mitigated by switching over to Podman and using it with the same commands as Docker:

podman run --dns 8.8.8.8 busybox nslookup google.com
Rauno56
  • 3
  • 1
Armin
  • 41
  • 1
  • 6