Disable Ubuntu's DNS stub resolver


I’m starting to experiment with Rancher to manage docker instances. However, when trying to starting the rancher-agent, the logs were showing that it didn’t like the lookback address being used for DNS resolution. It then promptly refused to go any further.

The stub resolver is intended to make things easier for users who move between networks and need a more dynamic method to select their DNS resolution server. Whether that is because they are a laptop user or they need to connect to a VPN periodically.

For a more static instance, such as my development machine, a fixed DNS resolution address will do me fine.

The following instructions are from Bastian Voigt’s answer on

How to disable systemd-resolved in Ubuntu?:

Disable the systemd-resolved service and stop it:

sudo systemctl disable systemd-resolved.service
sudo service systemd-resolved stop

Put the following line in the [main] section of your /etc/NetworkManager/NetworkManager.conf:


Delete the symlink /etc/resolv.conf

sudo rm /etc/resolv.conf

Restart network-manager

sudo service network-manager restart

Then I simply restarted my rancher-agent docker instance and it’s happy to continue.