title: How to build Docker Images with Dockerfile behind HTTP_PROXY by Jenkins?
body: <p>Building Docker images works in a desktop without a problem. Installing Node.js NPM dependencies work as usual. However, when using a continuous integration server such as Jenkins that is hosted behind a corporate proxy, the build Docker Images fail.</p>
  
  <h2>Node.js NPM Dependencies</h2>
  
  <p>While building Node.js pacakges, the command <strong>npm install</strong> fails when it cannot connect to GIT while cloning GIT dependencies.</p>
  
  <pre><code>e1ce5e8407d1: Already exists
  Status: Image is up to date for node:0.10.33
   ---&gt; e1ce5e8407d1
  Step 1 : RUN mkdir -p /usr/src/app
   ---&gt; Using cache
   ---&gt; 965cad0c68b0
  Step 2 : WORKDIR /usr/src/app
   ---&gt; Using cache
   ---&gt; 4c498f0c07e9
  Step 3 : COPY package.json /usr/src/app/
   ---&gt; b0662a8275fb
  Removing intermediate container 5aca20551452
  Step 4 : RUN npm install
   ---&gt; Running in 7ccf9e5362af
  npm WARN package.json newww@2.0.0 No README data
  npm WARN package.json Dependency 'async-cache' exists in both dependencies and devDependencies, using 'async-cache@^0.1.5' from dependencies
  npm ERR! git clone https://github.com/npm/npm2es.git Cloning into bare repository '/root/.npm/_git-remotes/https-github-com-npm-npm2es-git-60a75edb'...
  npm ERR! git clone https://github.com/npm/npm2es.git fatal: unable to access 'https://github.com/npm/npm2es.git/': Failed to connect to github.com port 443: Connection timed out
  </code></pre>
  
  <h2>Java Maven, Ruby, Go Docker Images with Dependencies</h2>
  
  <p>The same occurs when building Java, Ruby or Go containers, where dependencies are located in repository servers across your corporate Proxy server. </p>
  
  <p>Knowing that you can configure Docker with HTTP_PROXY environment variable, how to properly configure Docker to properly build images in CI environments?</p>