Skip to content

Instantly share code, notes, and snippets.

@nerdyman nerdyman/
Last active Apr 22, 2020

What would you like to do?
Fix docker DNS not working on Linux hosts

Docker DNS issues on systemd distros

(Hopefully) fix Docker DNS issues with systemd distros, e.g. ping: bad address '', Temporary failure resolving ... (tested on Arch).


  1. Host DNS is correct (/etc/resolv.conf) and does not contain any invalid nameservers
  2. Ensure DNS resolves correctly (dig
  3. Ensure Docker container has same config as host docker run -it <your-image> cat /etc/resolv.conf


  1. Allow docker network interface through firewall firewall-cmd --permanent --zone=trusted --change-interface=docker0
  2. Reload firewall firewall-cmd --reload
  3. Restart firewall service systemctl restart firewalld
  4. Restart network (I use NetworkManager) systemctl restart NetworkManager
  5. Kill all the Docker things docker system prune --all --force
  6. Restart Docker systemctl restart docker
  7. Try ping on image docker run -it <your-image> cat /etc/resolv.conf

Example test: docker run busybox ping -c 3

Nuclear Solution

If all else fails try stopping firewalld altogether systemctl stop firewalld

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.