Skip to content

DNS resolution failure on Docker for Mac with IPv6 nameservers #28573

@chrismoos

Description

@chrismoos

Description

If the OS X network settings have an IPv6 DNS server in the DNS Servers list then all DNS queries will fail (timeout) in docker containers. Even if there are valid IPv4 DNS server listed, the presence of a single IPv6 server causes resolution to fail.

A simple workaround for this issue (besides manually overriding your DNS settings on the Mac) is to connect to Moby and force DNS servers in the docker daemon:

Open /etc/init.d/docker and add the --dns flag:

case "$(mobyplatform)" in
        windows|mac)
                DOCKER_OPTS="${DOCKER_OPTS} --swarm-default-advertise-addr=eth0 --dns 8.8.8.8 --dns 8.8.4.4"
                ;;
esac

Then run

$ service docker restart

Steps to reproduce the issue:

  1. Add an IPv6 nameserver and an IPv4 nameserver to your network settings.
  2. Run a Docker container and try to ping a host.

Describe the results you received:

Failure to use DNS in Docker container.

Describe the results you expected:

DNS functions normally.

Additional information you deem important (e.g. issue happens only occasionally):

It seems like probably others have ran into this issue (possibly unknowingly) in #24344.

Output of docker version:

Client:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Thu Oct 27 00:09:21 2016
 OS/Arch:      darwin/amd64
 Experimental: true

Server:
 Version:      1.12.3
 API version:  1.24
 Go version:   go1.6.3
 Git commit:   6b644ec
 Built:        Thu Oct 27 00:09:21 2016
 OS/Arch:      linux/amd64
 Experimental: true

Output of docker info:

Containers: 113
 Running: 1
 Paused: 0
 Stopped: 112
Images: 1149
Server Version: 1.12.3
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 1298
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: host bridge null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.30-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.951 GiB
Name: moby
ID: TB4S:V22M:Y2IP:IBBK:MJO6:DHX5:LEQ2:NAGC:BRX6:H5AI:6HR4:NMAI
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 18
 Goroutines: 36
 System Time: 2016-11-18T07:18:08.844111745Z
 EventsListeners: 0
No Proxy: *.local, 169.254/16
Username: chris
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:

Additional environment details (AWS, VirtualBox, physical, etc.):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions