docker npm install错误:getaddrinfo ENOTFOUND注册表.npmjs.org注册表.npmjs.org:443 [英] docker npm install Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
问题描述
我在RHEL 7上使用的是Docker 1.10.1版,并且在使用以下Dockerfile时出现npm安装错误。错误:getaddrinfo ENOTFOUND Registry.npmjs.org Registry.npmjs.org:443。在ubuntu 14.04上使用docker 1.91进行相同的工作。当我得到bash并在容器上安装inetutils-ping时,我发现我无法在任何地方ping
I'm using docker version 1.10.1 on RHEL 7 and getting npm install error when using below Dockerfile. The Error: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443. The same work with docker 1.91 on ubuntu 14.04. When I get bash and install inetutils-ping on container I noticed I can't ping anywhere
root@9deb4b274c1e:/home/nodexp#ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
^C--- 8.8.8.8 ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss
为什么?当然我可以从RHEL ping
Why is that ? Of course I can ping from RHEL
Dockerfile
Dockerfile
FROM node:argon
# Create user nodexp in group nodexp
RUN groupadd -r nodexp \
&& useradd -m -r -g nodexp nodexp
WORKDIR /home/nodexp
# Install app dependencies
COPY package.json /home/nodexp
RUN npm install
# Bundle app source
COPY . /home/nodexp
EXPOSE 3000
CMD [ "npm", "start" ]
和package.json
and package.json
{
"name": "mp",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node app.js"
},
"dependencies": {
"express": "~4.13.1"
}
}
推荐答案
使用此命令重新启动docker为我修复了它,但我不知道为什么
restarting docker with this command fixes it for me but I don't know why
sudo服务docker restart
这篇关于docker npm install错误:getaddrinfo ENOTFOUND注册表.npmjs.org注册表.npmjs.org:443的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!