机器已经安装好docker, 版本是Docker version 1.9.1, build a34a1d5。
1. 从163下载镜像
docker pull hub.c.163.com/public/nodejs:5.7.0
2. 编写Dockerfile
WORKDIR /app
COPY . /app
RUN npm install
EXPOSE 8123
CMD ["npm", "start"]
3. 编写Package.json
{
"name": "nodetest",
"version": "1.0.0",
"description": "Node.js on Docker",
"author": "boatman",
"main": "test.js",
"scripts": {
"start": "node test.js"
},
"dependencies": {
"express": "^4.13.3"
}
}
4. 编写test.js
var expr
1. 从163下载镜像
docker pull hub.c.163.com/public/nodejs:5.7.0
2. 编写Dockerfile
FROM hub.c.163.com/public/nodejs:5.7.0
RUN mkdir -p /appWORKDIR /app
COPY . /app
RUN npm install
EXPOSE 8123
CMD ["npm", "start"]
3. 编写Package.json
{
"name": "nodetest",
"version": "1.0.0",
"description": "Node.js on Docker",
"author": "boatman",
"main": "test.js",
"scripts": {
"start": "node test.js"
},
"dependencies": {
"express": "^4.13.3"
}
}
4. 编写test.js
var expr