title: Dockerfile: Docker build can't download packages: centos->yum, debian/ubuntu->apt-get behind intranet
body: <p>PROBLEM: Any build, with a Dockerfile depending on centos, ubuntu or debian fails to build.</p>
  
  <p>ENVIRONMENT: I have a Mac OS X, running VMWare with a guest Ubuntu 14.04, running Docker:</p>
  
  <pre><code>mdesales@ubuntu ~ $ sudo docker version
  Client version: 1.1.2
  Client API version: 1.13
  Go version (client): go1.2.1
  Git commit (client): d84a070
  Server version: 1.1.2
  Server API version: 1.13
  Go version (server): go1.2.1
  Git commit (server): d84a070
  </code></pre>
  
  <p>BEHAVIOR: Using "docker build" fails to download packages. Here's an example of such Dockerfile: <a href="https://github.com/Krijger/docker-cookbooks/blob/master/jdk8-oracle/Dockerfile">https://github.com/Krijger/docker-cookbooks/blob/master/jdk8-oracle/Dockerfile</a>, <a href="https://github.com/ottenhoff/centos-java/blob/master/Dockerfile">https://github.com/ottenhoff/centos-java/blob/master/Dockerfile</a></p>
  
  <p>I know that we can run a container with --dns, but this is during the build time.</p>
  
  <ul>
  <li><p>CENTOS</p>
  
  <p>FROM centos
  RUN yum install a b c</p></li>
  <li><p>UBUNTU</p>
  
  <p>FROM ubuntu
  RUN apt-get install a b c</p></li>
  </ul>
  
  <p>Users have reported that it might be problems with DNS configuration, others and the configuration has the Google's DNS servers commented out.</p>
  
  <pre><code>Step 2 : RUN yum install -y curl; yum upgrade -y; yum update -y;  yum clean all
   ---&gt; Running in 5f11b65c87b8
  Loaded plugins: fastestmirror
  Couldn't resolve host 'mirrorlist.centos.org
  </code></pre>
  
  <p>Still the problem persisted... So, most users on #docker@Freenode mentioned that it might be a problem with the DNS configuration... So here's my Ubuntu:</p>
  
  <pre><code>$ sudo cat /etc/resolv.conf 
  nameserver 127.0.1.1
  search localdomain
  </code></pre>
  
  <p>I tried changing that, same problem...</p>