Ubuntu 20.04
Linux Mint 20+
mkdir /etc/systemd/resolved.conf.d
cat << EOF > /etc/systemd/resolved.conf.d/docker.conf
[Resolve]
DNS=127.0.0.1
Domains=~docker
EOF
service systemd-resolved restart
apt install dnsmasq
echo -e "bind-interfaces\naddress=/docker/127.0.0.1\n\n$(cat /etc/dnsmasq.conf)" > /etc/dnsmasq.conf
systemctl enable dnsmasq.service
thanks it made my day :p
I added
no-resolv
to dnsmasq.conf to avoid to query back systemd-resolved for the dns query.