title: Docker build has no network, but docker run has
body: <p>If I want to build my Dockerfile, it can't connect to the network or at least DNS:</p>
  
  <pre><code>Sending build context to Docker daemon 15.95 MB
  Sending build context to Docker daemon 
  Step 0 : FROM ruby
   ---&gt; eeb85dfaa855
  Step 1 : RUN apt-get update -qq &amp;&amp; apt-get install -y build-essential libpq-dev
   ---&gt; Running in ec8cbd41bcff
  W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/InRelease  
  
  W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/InRelease  
  
  W: Failed to fetch http://security.debian.org/dists/jessie/updates/InRelease  
  
  W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie/Release.gpg  Could not resolve 'httpredir.debian.org'
  
  W: Failed to fetch http://httpredir.debian.org/debian/dists/jessie-updates/Release.gpg  Could not resolve 'httpredir.debian.org'
  
  W: Failed to fetch http://security.debian.org/dists/jessie/updates/Release.gpg  Could not resolve 'security.debian.org'
  
  W: Some index files failed to download. They have been ignored, or old ones used instead.
  Reading package lists...
  Building dependency tree...
  Reading state information...
  E: Unable to locate package build-essential
  INFO[0001] The command "/bin/sh -c apt-get update -qq &amp;&amp; apt-get install -y build-essential libpq-dev" returned a non-zero code: 100
  </code></pre>
  
  <p>But if I run exactly the same command via <code>docker run</code> it works:</p>
  
  <pre><code>docker run --name="test" ruby /bin/sh -c 'apt-get update -qq &amp;&amp; apt-get install -y build-essential libpq-dev'
  </code></pre>
  
  <p>Does anybody have an idea, why <code>docker build</code> does not work? I have tried all DNS related tipps on StackOverflow, like starting docker with --dns 8.8.8.8 etc.</p>
  
  <p>Thanks in advance</p>