Sample of express application running in docker container using pm2
- Install app packages
npm install
- Add local configuration file
[dev.json]
underserver/src/node_modules/config
- Create docker image
docker build -t [imagename:tag] .
- Run container
docker run -p 9000:3000 -d [imagename:tag]
- Test it using this command curl
localhost:9000
- Adjust
prod.json
file to fit your needs - Create docker image
docker build -t [imagename:tag] .
- Login to your docker hub account
docker login
- Push the container using
docker push
- Run it wherever you want
- Load balancing using PM2
Change instances count in
process.json
- Real time monitoring with KEYMETRICS
docker run -e KEYMETRICS_PUBLIC=XXXX -e KEYMETRICS_SECRET=YYYY -p 9000:3000 -d [imagename:tag]
MIT. Copyright (c) 2015-2018 Ashot Harutyunyan