title: Docker: npm install behind proxy
body: <p>I have this Dockerfile:</p>
  
  <pre><code>FROM node:argon
  
  ENV http_proxy http://user:pass@proxy.company.priv:3128
  ENV https_proxy https://user:pass@proxy.company.priv:3128
  
  RUN mkdir -p /usr/src/app
  WORKDIR /usr/src/app
  
  # Install app dependencies
  COPY package.json /usr/src/app/
  RUN npm install
  
  # Bundle app source
  COPY . /usr/src/app
  
  EXPOSE 8080
  CMD [ "npm", "start" ]
  </code></pre>
  
  <p>But I get this error, in <strong>npm install</strong> step:</p>
  
  <blockquote>
    <p>npm info it worked if it ends with ok npm info using npm@2.14.12 npm
    info using node@v4.2.6 npm WARN package.json deployer-ui@1.0.0 No
    description npm WARN package.json deployer-ui@1.0.0 No repository
    field. npm WARN package.json deployer-ui@1.0.0 No README data npm info
    preinstall deployer-ui@1.0.0 npm info attempt registry request try #1
    at 7:09:23 AM npm http request GET
    <a href="https://registry.npmjs.org/body-parser" rel="noreferrer">https://registry.npmjs.org/body-parser</a> npm info attempt registry
    request try #1 at 7:09:23 AM npm http request GET
    <a href="https://registry.npmjs.org/express" rel="noreferrer">https://registry.npmjs.org/express</a> npm info retry will retry, error on
    last attempt: Error: tunneling socket could not be established,
    cause=write EPROTO npm info retry will retry, error on last attempt:
    Error: tunneling socket could not be established, cause=write EPROTO</p>
  </blockquote>
  
  <p>I guess it is due to the proxy. I have also tried to put</p>
  
  <pre><code>RUN npm config set proxy http://user:pass@proxy.company.priv:3128
  RUN npm config set https-proxy http://user:pass@proxy.company.priv:3128
  </code></pre>
  
  <p>but still getting the same error.</p>
  
  <p>Moreover, in my file <strong>/etc/systemd/system/docker.service.d/http-proxy.conf</strong> I have this:</p>
  
  <pre><code>Environment="HTTP_PROXY=http://user:pass@proxy.company.priv:3128"
  Environment="HTTPS_PROXY=https://user:pass@proxy.company.priv:3128"
  </code></pre>
  
  <p>Thanks in advance.</p>