(Hopefully) fix Docker DNS issues with systemd distros, e.g. ping: bad address 'google.com', Temporary failure resolving ..., EAI_AGAIN (tested on Arch).
- Host DNS is correct (
/etc/resolv.conf) and does not contain any invalid nameservers - Ensure DNS resolves correctly (
dig google.com @ipaddress.from.resolvconf.here) - Ensure Docker container has same config as host
docker run -it <your-image> cat /etc/resolv.conf
- Allow docker network interface through firewall
firewall-cmd --permanent --zone=trusted --change-interface=docker0 - Reload firewall
firewall-cmd --reload - Restart firewall service
systemctl restart firewalld - Restart network (I use NetworkManager)
systemctl restart NetworkManager - Kill all the Docker things
docker system prune --all --force - Restart Docker
systemctl restart docker - Try ping on image
docker run -it <your-image> cat /etc/resolv.conf
Example test: docker run busybox ping -c 3 google.com
If all else fails try stopping firewalld altogether systemctl stop firewalld