NPM installation is not performed inside the Docker container, but runs on a host with a corporate proxy

I am deploying some node.js services for the corporate system in docker containers. My Dockerfiles for these services are very simple, except that I set the proxy environment variables:

FROM node:4.2.3 ADD . /src WORKDIR /src ENV http_proxy http://proxy.gc.corp.com:8888/ ENV https_proxy http://proxy.gc.corp.com:8888/ ENV HTTP_PROXY http://proxy.gc.corp.com:8888/ ENV HTTPS_PROXY http://proxy.gc.corp.com:8888/ RUN npm install --production EXPOSE 3000 CMD npm start >> /log/eva_web_api 

When I create my image from this file, I get the following error from NPM:

Error on last try: Error: tunnel socket could not be installed, reason = getaddrinfo ENOTFOUND proxy.gc.corp.com proxy.gc.corp.com:8888

However, when I perform the NPM installation on the host machine (which has node.js as well as Docker), the NPM installation performs as usual without any problems. On one host, I have the same ENV variables as in my Docker file.

Anyone have ideas on what is going on here, I have a ticket open with my proxy server network team, but they still won't help.

+5
source share
1 answer

This DNS connection found my solution here:

Docker - Failed network calls when building an image on a corporate network

TL; DR; I need to configure DOCKER_OPTS with my DNS IP address.

0
source

Source: https://habr.com/ru/post/1242907/


All Articles