0

I have following Dockerfile:

FROM node:8
WORKDIR /tmp
COPY package.json /tmp/
RUN npm config set registry http://xxx:8081/repository/npm-group/
RUN npm install

WORKDIR /opt/app
COPY . /opt/app/
RUN cp -a /tmp/node_modules /opt/app/

EXPOSE 3000

ENTRYPOINT [ "npm", "start" ]

When I try to build an image using:

docker build -t blah .

All goes well until I get to step 5/10, npm install. The logs show:

npm ERR! errno ETIMEDOUT
npm ERR! network request to http://xxx:8081/repository/npm-group/prop-types failed, reason: connect ETIMEDOUT x.x.x.x:8081

I have no idea what is happening. The Nexus repository is hosted on the internal network, so I have no idea why it cannot be contacted.

Iptables shows the following:

philippe@laptop:~/localdev/react-starterkit$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
DOCKER-USER  all  --  anywhere             anywhere            
DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate  RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain DOCKER (1 references)
target     prot opt source               destination         

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target     prot opt source               destination         
DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            

Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            

Chain DOCKER-USER (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere            

Any ideas?

Homewrecker
  • 1,076
  • 1
  • 15
  • 38
  • Is your "internal network" one to which your host is directly connected, or is it accessible via some sort of VPN? – larsks Jul 03 '18 at 13:18
  • are you able to ping this inside container ? `docker exec -it bash` and `ping ` also share the output of `telnet 8081` – chintan thakar Jul 03 '18 at 13:27
  • @larsks I am directly connected via wired connection. I can access Nexus from my host. I cannot build the image so I cannot run the container and perform the ping command. – Homewrecker Jul 03 '18 at 13:39

1 Answers1

0

I resolved it using https://stackoverflow.com/a/45644890/2122950 The DNS of my company was not present in /etc/resolv.conf

Homewrecker
  • 1,076
  • 1
  • 15
  • 38