Score:0

DNS does not work in docker. Docker can reach DNS provider and has correct IP. Host works

es flag

I have Docker installed on Ubuntu Server 22.04 (via apt not snap). Everything was working until I upgraded from 20.04 to 22.04. Now, DNS does not work inside docker.

$ sudo docker run busybox nslookup google.com
Server:         1.1.1.1
Address:        1.1.1.1:53

Non-authoritative answer:
Name:   google.com
Address: 172.217.0.78

*** Can't find google.com: No answer

as you can see, docker is attempting to use 1.1.1.1 to resolve the domain but cannot reach it. If we do the same thing on the host

$ nslookup google.com
Server:         1.1.1.1
Address:        1.1.1.1#53

Non-authoritative answer:
Name:   google.com
Address: 172.217.0.78
Name:   google.com
Address: 2607:f8b0:4025:815::200e

everything works as expected.

Docker can for sure reach the DNS server because we can ping it

$ sudo docker run busybox ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1): 56 data bytes
64 bytes from 1.1.1.1: seq=0 ttl=56 time=13.370 ms
64 bytes from 1.1.1.1: seq=1 ttl=56 time=15.364 ms
64 bytes from 1.1.1.1: seq=2 ttl=56 time=11.075 ms
64 bytes from 1.1.1.1: seq=3 ttl=56 time=10.229 ms
64 bytes from 1.1.1.1: seq=4 ttl=56 time=11.113 ms
64 bytes from 1.1.1.1: seq=5 ttl=56 time=17.715 ms
^C
--- 1.1.1.1 ping statistics ---
6 packets transmitted, 6 packets received, 0% packet loss
round-trip min/avg/max = 10.229/13.144/17.715 ms

resolv.conf is pretty typical

$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.
nameserver 1.1.1.1
nameserver 127.0.0.1
nameserver 172.17.0.1
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.