Public | Automated Build

Last pushed: a day ago
Short Description
PM2 official Docker image with Alpine, PM2 docker, dumb-init and optional Keymetrics integration
Full Description

keymetrics/pm2-docker-alpine

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 keymetrics/pm2-docker-alpine

Versions available:

  • keymetrics/pm2-docker-alpine:latest with node:alpine
  • keymetrics/pm2-docker-alpine:8 with node:8-alpine
  • keymetrics/pm2-docker-alpine:7 with node:7-alpine
  • keymetrics/pm2-docker-alpine:6 with node:6-alpine
  • keymetrics/pm2-docker-alpine:4 with node:4-alpine
  • keymetrics/pm2-docker-alpine:next with node:alpine and pm2@next

These images are automatically built from the Docker hub based on this Github repository folder arrangement.

Hub link

Running the container

Make sure you declared a process file called process.yml, this file will be started by PM2.

# Get example app
$ git clone https://github.com/keymetrics/pm2-docker-alpine
# Run example app, mounted as a volume
$ docker run -p 80:3000 -v `pwd`/example_app:/app keymetrics/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

Docker Pull Command
Owner
keymetrics
Source Repository

Comments (4)
simonepri
17 days ago

Hi all,

If you have an issue with the image, or a question, you can file an issue on GitHub here:

https://github.com/keymetrics/pm2-docker-alpine/issues

Thanks

kuchiriel
a month ago

It have yarn?

centigrade
a month ago

Nevermind, I confused apt with apk.

To install git to this image you can use

RUN apk update && \
apk upgrade && \
apk add git

centigrade
a month ago

Is there a way to make git available inside the container? I tried to add a build step to install git via apt-get but that does not seem to be available either.