DEV Community

Cover image for Local DNS resolver found in resolv.conf and containers can't use it
Adam K Dean
Adam K Dean

Posted on

3

Local DNS resolver found in resolv.conf and containers can't use it

I've been playing with Docker for part of a project, and came across this annoying but important message:

WARNING: Local (127.0.0.1) DNS resolver found in resolv.conf and containers can't use it. Using default external servers : [8.8.8.8 8.8.4.4]

The problem? /etc/resolv.conf has nameserver 127.0.0.1 (or nameserver 127.0.1.1) in it.

I worked out that Ubuntu 14.04 LTS uses a daemon called dnsmasq, which routes DNS traffic through to the DNS servers provided by DHCP.

While this works fine for Docker, that message is quite annoying.

I disabled dnsmasq in /etc/NetworkManager/NetworkManager.conf:

$ sudo nano /etc/NetworkManager/NetworkManager.conf

#dns=dnsmasq
Enter fullscreen mode Exit fullscreen mode

I then added the public Google DNS servers to /etc/dhcp/dhclient.conf:

$ sudo nano /etc/dhcp/dhclient.conf

prepend domain-name-servers 8.8.8.8,8.8.4.4;
Enter fullscreen mode Exit fullscreen mode

Then you just need to restart NetworkManager:

$ sudo restart network-manager
Enter fullscreen mode Exit fullscreen mode

And now you can start Docker containers without that pesky message!

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more