Node.js lightweight Docker image including the PM2 runtime for production applications.
This Docker image in association with PM2, increase application uptime, increase performance (spawn multiple processes and load-balance network query without any code change) and allow graceful state change, adapted to production environment. Usage
$ docker pull 1984tuanna/pm2-docker-alpine
These images are automatically built from the Docker hub based on this Github repository branch arrangement.
Hub link Running the container
Make sure you declared a process file called process.yml, this file will be started by PM2.
$ docker run -p 80:3000 -v pwd/example_app:/app 1984tuanna/pm2-docker-alpine
For Keymetrics linking you can set the extra env variables:
-e "KEYMETRICS_SECRET=YYY -e "KEYMETRICS_PUBLIC=XXX" -e "INSTANCE_NAME=hostname"
Log output
Append to pm2-docker CMD directive:
--json to output logs in JSON
--format to output logs in key=val style
--raw to display logs in raw format
Actions Monitoring CPU/Usage of each process
$ docker exec -it <container_id> pm2 monit
Listing managed processes
$ docker exec -it <container_id> pm2 list
Get more information about a process
$ docker exec -it <container_id> pm2 show <app_name>
0sec downtime reload all applications
$ docker exec -it <container_id> pm2 reload all
Automatically synchronize your application with git
Add into your Dockerfile:
RUN pm2 install pm2-auto-pull
Or try it:
$ docker exec -it <container_id> pm2 install pm2-auto-pull
Make sure the .git is present in your application source folder. License
MIT
Content type
Image
Digest
Size
40.5 MB
Last updated
almost 10 years ago
docker pull 1984tuanna/pm2-docker-alpine