Docker on Fedora 33 has issues with systemd-resolved
. This causes DNS issues when, for example, connecting VPNs, because it'll use the wrong DNS server, especially if you have several configured. The one from systemd-resolved
is ignored since it's a 127.0.0.X
address.
This causes containers to not be able to resolve addresses on the private network (VPN).
Use dnsmasq
to listen on docker0
and forward DNS requests to systemd-resolved
running on 127.0.0.53
.
Note: This assumes docker0
has an IP address of 172.17.0.1
. Update according to your setup.
dnf install dnsmasq
Edit /etc/dnsmasq.conf
# Use interface docker0
interface=docker0
# Explicitly specify the address to listen on
listen-address=172.17.0.1
# Looks like docker0 interface is not available when dnsmasq service starts so it fails. This option makes dynamically created interfaces work in the same way as the default.
bind-dynamic
# Set systemd-resolved DNS server
server=127.0.0.53
Note: make sure to comment out bind-interfaces
, or the service won't start properly! dnsmasq
can't have both bind-dynamic
and bind-interfaces
on the same configuration file.
Edit /etc/docker/daemon.json
and ensure 172.17.0.1
is set on the DNS array:
{
"dns": ["172.17.0.1"]
}
systemctl enable dnsmasq
systemctl restart dnsmasq
systemctl restart docker