dockerfiles-windows: npm install error - getaddrinfo EAI_AGAIN registry.npmjs.org:443
Everytime I try to npm install a file I get the following error:
getaddrinfo EAI_AGAIN registry.npmjs.org:443
I am using stefanscherer/node-windows:8.9.3 image but have had this issue with many other images as well.
Initial npm error:

npm logs:

About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 35 (3 by maintainers)
This known issue for Docker and is discussed in detail here: https://development.robinwinslow.uk/2016/06/23/fix-docker-networking-dns/
Simple fix is to create the file
/etc/docker/daemon.jsonand insert:
where
10.0.0.2is the first DNS server your machine requests records from, and8.8.8.8is the fallback DNS server, google in this case.I couldn’t resolve issue with adding DNS setting to docker daemon, but I found another solution (maybe this will be useful for someone) - just use host network to resolve dns names by adding
--network hostsetting, ex.:docker build . --network host -t mytag ...I got a server network issue, and a client restart to let me ssh, and the problem happened. I’ll show my steps to slove this issue, hope it help someone 😄
sudo service docker restartorsudo systemctl restart dockerto restart docker.Restarting system resolved my issue.
Yes! It worked! Thank you!
/etc/docker/daemon.jsondo not work for me. I have to reboot my ubuntu server to resolve my problem.worked for me 😊
I had the same issue on WSL2 Ubuntu, @binarymist solution worked.
Worked for me.
hey guys,
i run Docker 24.0.7 on Ubuntu 22.04.3 LTS. i tried installing express module on a Node.js container (docker run -v $PWD:/app -w /app node npm install express) but it failed with the same errors.
weird but… a restart solved my problem too!!!
could be related to any port mapping i run before that with Nginx container (docker run -p 8080:80 -v $PWD:/usr/share/nginx/html nginx) i saw it created a FW rule on my Ubuntu
This works for me. Thanks a lot dude.
This solved my issue on Fedora 32.
@karanvij-ai Seeing the same issue, were you able to find a fix?
Hi All,
I am running Docker Toolbox on windows 10 home.
Following were the steps(In Docker console -> Docker Quick Start and using bash from git installation):
Created docker file(Dockerfile.dev):
FROM node:alpine
WORKDIR ‘/app’
COPY package.json .
RUN npm install
COPY . .
CMD [“npm”, “run”, “start”]
$ docker build -f Dockerfile.dev .
Output in console:
Sending build context to Docker daemon 146.5MB Step 1/6 : FROM node:alpine —> ef7d474eab14 Step 2/6 : WORKDIR ‘/app’ —> Using cache —> c47b0eb2c3c1 Step 3/6 : COPY package.json . —> Using cache —> e5c66b740c8b Step 4/6 : RUN npm install —> Running in 962746bea142 npm ERR! code EAI_AGAIN npm ERR! errno EAI_AGAIN npm ERR! request to https://registry.npmjs.org/react failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org
npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2019-09-21T01_00_35_350Z-debug.log The command ‘/bin/sh -c npm install’ returned a non-zero code: 1
Also, I couldn’t find the complete log, not sure where is location.
Please help, Thanks