npm install returns connection timeout while building docker image
In my case works with this steps:
- In the Host, I change Host Server/etc/sysctl.conf:
I added
net.ipv4.ip_forward=1
I use
nslookup registry.npmjs.org
Give me the IP 104.16.25.38
- Docker Build with IP
docker build . --add-host registry.npmjs.org:104.16.25.38 -t test
In my case works with this below single step,
docker build --add-host registry.npmjs.org:104.16.25.38 -t .