Solved: Docker 1.12.0-rc2-beta17 (build: 9779) - containers failed to resolve dns

in container:

Expected behavior

$ nslookup docker.com
Server: 127.0.0.11
Address: 127.0.0.11#53

Non-authoritative answer:
Name: docker.com
Address: 52.22.176.206

Actual behavior

$ nslookup docker.com
;; connection timed out; no servers could be reached

Information

  • the output of:
    • Moby Menu > Diagnose & Feedback on OSX
      78E77010-D3E4-4A8C-9AD9-3321F3844E25
  • a reproducible case if this is a bug, Dockerfiles FTW

$ docker run -t -i ubuntu /bin/bash
Unable to find image ‘ubuntu:latest’ locally
Pulling repository Docker Hub Container Image Library | App Containerization
docker: Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/ubuntu/images. You may want to check your internet connection or if you are behind a proxy…
See ‘docker run --help’.

$ curl -I https://index.docker.io/v1/repositories/library/ubuntu/images
HTTP/1.1 405 METHOD NOT ALLOWED
Server: nginx/1.6.2
Date: Mon, 04 Jul 2016 11:38:43 GMT
Content-Type: text/html; charset=utf-8
Vary: Cookie

Solved: there are three custom DNS servers has been added in network settings, first of it was unreachable local ip. So docker machine could not resolve dns, it is ignored other two listed dns servers.