Node.js Web on Docker
1. init Project
1 | npm init |
2. Edit package.json
1 | { |
3. Install express.js
1 | npm install express --save |
4.Creat index.js
1 | 'use strict'; |
5. Creat Dockerfile
1 | FROM node:8 |
6. Build Docker Images
1 | docker build -t node-web-app . |
7. Docker Run
1 | docker run -p 49160:8080 -d --name node-web-app node-web-app |
8. Demo
1 | curl 127.0.0.1:49160 |