title: Ubuntu docker container fails apt-get update
body: <p>So I have a rather strange issue with my docker installation:</p>
  
  <p>If I run</p>
  
  <pre><code>apt-get update
  </code></pre>
  
  <p>inside e.g. a debian container (<code>docker run -it --rm debian</code>) it always fails with error like</p>
  
  <pre><code>Err:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
  </code></pre>
  
  <p>Now this seems to be a DNS issue as discussed in so many other similar posts but here comes my spin on this issue: When I then try to ping the host</p>
  
  <pre><code>ping security.ubuntu.com
  </code></pre>
  
  <p>it works perfectly fine. The domain gets resolved and the pings work.
  e.g.</p>
  
  <pre><code>$ docker run -it —rm debian
  root@0b6a6ec41a37:/# ping google.com
  PING google.com (172.217.19.174): 56 data bytes
  64 bytes from 172.217.19.174: icmp_seq=0 ttl=55 time=0.943 ms
  </code></pre>
  
  <p>I then tried an <code>nslookup</code> in a busybox container (<code>docker run -it --rm busybox</code>) which also works perfectly fine.</p>
  
  <p>I started investigating this because I wanted to setup nextcloud with docker and the admin interface reports that the server could not verify a working internet connection because it can't resolve e.g. github.com.</p>
  
  <p>The next amazing bit comes when I then connect to the running nextcloud container and do my tests on the commandline there. <code>ping</code> again works fine and this time even <code>apt-get update</code> works?!</p>
  
  <p>I have done these tests both with ufw enabled and disabled. Same result.</p>
  
  <p>I am now quite confused as to what is going on. Something must be wrong, either on my server or my networking around it but I can't figure out what the issue could be.</p>
  
  <p>If someone already had such an issue it would be great to hear your take/solution. Thank you :)</p>
  
  <p>Environment:<br>
  Host: Ubuntu 16.04.03-LTS<br>
  Docker: 17.09.0-ce</p>
  
  <p>My <code>daemon.json</code>:</p>
  
  <pre><code>{
      "graph": "/mnt/nfs/nas/docker",
      "iptables": true,
      "dns": ["10.0.16.1"],
      "userland-proxy": true,
      "ip": "127.0.0.1"
  }
  </code></pre>
  
  <p>//Edit 02-10-2017</p>
  
  <p>Regarding the resolv.conf and DNS Settings: Yes, I tried omitting  the "dns" field in the daemon.json, then it just takes the value from the host resolv.conf and I also tried using "8.8.8.8" with the same result. My host resolv.conf contains:</p>
  
  <pre><code>nameserver 10.0.16.1
  </code></pre>