docker.io containers cannot use local dnsmasq

Bug #1387805 reported by Horst Schirmeier
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
docker.io (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

docker.io (1.0.1~dfsg1-0ubuntu1~ubuntu0.14.04.1 from trusty-updates) containers fail to resolve host names if dnsmasq is used in the host system:

$ docker build -t some-image
Sending build context to Docker daemon 4.096 kB
Sending build context to Docker daemon
Step 0 : FROM ubuntu:utopic
Pulling repository ubuntu
277eb4304907: Download complete
511136ea3c5a: Download complete
e12c576ad8a1: Download complete
102eb2a101b8: Download complete
530dbbae98a0: Download complete
37dde56c3a42: Download complete
8f118367086c: Download complete
 ---> 277eb4304907
Step 1 : MAINTAINER [...]
 ---> Running in 0d7110f3c6b3
 ---> 6ad364dded22
Removing intermediate container 0d7110f3c6b3
Step 2 : RUN apt-get update
 ---> Running in 38995d975211
Err http://archive.ubuntu.com utopic InRelease
Err http://archive.ubuntu.com utopic-updates InRelease
Err http://archive.ubuntu.com utopic-security InRelease
Err http://archive.ubuntu.com utopic Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com utopic-updates Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com utopic-security Release.gpg
  Could not resolve 'archive.ubuntu.com'
[...]

$ grep nameserver /etc/resolv.conf
nameserver 127.0.1.1

Workaround: Disable dnsmasq by commenting it out the "dns=dnsmasq" line in /etc/NetworkManager/NetworkManager.conf and restarting the network-manager and docker.io services (sudo service network-manager restart && sudo service docker.io restart). Alternatively enable the commented out DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4" line in /etc/default/docker.io (and also restart the docker.io service). The latter workaround of course requires the 8.8.8.8 / 8.8.4.4 servers to be reachable from your network.

See also:
https://stackoverflow.com/questions/25130536/dockerfile-docker-build-cant-download-packages-centos-yum-debian-ubuntu-ap
https://github.com/docker/docker/issues/541
https://stackoverflow.com/questions/24991136/docker-build-could-not-resolve-archive-ubuntu-com-apt-get-fails-to-install-a

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in docker.io (Ubuntu):
status: New → Confirmed
Revision history for this message
Paul Annekov (paul.annekov) wrote :

Second solution does not work for me. First solution (with NetworkManager.conf) perfectly solves my problem.

OS: Xubuntu 15.04
Docker: 1.7.0-dev, build 5e06332 (from ppa)

Revision history for this message
Paul Tagliamonte (paultag) wrote :

127.0.0.1 inside the container isn't the same as 127.0.0.1 inside the container.

I'm OK calling this a container misconfiguration.

I've not tried, but try setting dnsmasq to bind to the docker0 interface (likely bind to 172.17.42.1) and hit that IP.

Otherwise you're hitting 127.0.0.1 in the container, which isn't what you want (or where dnsmasq is bound)

This is part of network namespacing.

Closing the ticket, thanks!

Changed in docker.io (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.