Dockerfile文件:
#制定node镜像的版本
FROM node:8.9-alpine
#声明作者
MAINTAINER test
#移动当前目录下面的文件到app目录下
ADD . /app/
#进入到app目录下面,类似cd
WORKDIR /app
#安装依赖
RUN npm install
#对外暴露的端口
EXPOSE 3000
#程序启动脚本
CMD ["npm", "start"]
执行镜像构建 docker build -t docker_demo . 命令后:
[root@cd56723212387 testnodejs]# docker build -t docker_demo .
Sending build context to Docker daemon 17.92 kB
Step 1/7 : FROM node:8.9-alpine
Trying to pull repository docker.io/library/node ...
8.9-alpine: Pulling from docker.io/library/node
605ce1bd3f31: Pull complete
79b85b1676b5: Pull complete
20865485d0c2: Pull complete
Digest: sha256:6bb963d58da845cf66a22bc5a48bb8c686f91d30240f0798feb0d61a2832fc46
Status: Downloaded newer image for docker.io/node:8.9-alpine
---> 406f227b21f5
Step 2/7 : MAINTAINER test
---> Running in 641a6df02500
---> c957a05f33c1
Removing intermediate container 641a6df02500
Step 3/7 : ADD . /app/
---> ba5d7c9c701d
Removing intermediate container 52c5456d5f6d
Step 4/7 : WORKDIR /app
---> 7fc86e6854d1
Removing intermediate container c2a6af1b18fd
Step 5/7 : RUN npm install
---> Running in c715c3318df3
**npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/express failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2018-08-07T01_25_32_257Z-debug.log
The command '/bin/sh -c npm install' returned a non-zero code: 1**
[root@cd56723212387 testnodejs]#
大伙给看看什么原因
拿走