Public Repository

Last pushed: 10 months ago
Short Description
ubuntu 16 + Node.js 6.7.0 and PM2 to manage applications
Full Description

Docker Node.js

Base image to run Node.js (6.7) with PM2 to manage common operations and supervision over applications.

Get image

$ sudo docker pull extralam/nodejs_pm2

Basic use

$ sudo docker run -it -p 8000:8000 docker pull extralam/nodejs_pm2

With this command you will get a shell.
From here, you can start as many applications as you want with pm2 start [application].js.

Then, you can manage your applications with PM2 (https://github.com/Unitech/PM2/blob/master/README.md).

Start an application on container run
$ sudo docker run -d -p 8000:8000 --name mynodejsapp -v /host_apps/apps:/apps docker pull extralam/nodejs_pm2 pm2 start /apps/app.js --watch -i 0 --no-daemon

Sample use in docker-compose

app:
  image: extralam/nodejs_pm2
  volumes:
    - /path_to_apps_location/apps:/apps
  ports:
    - "8000:8000"
  command: pm2 start /apps/app.js --watch -i 0 --no-daemon
  links:
    - db  
db:
  image: tutum/mongodb

No daemon
If you start container with an app directly (in docker command line or in docker-compose yaml file), is important to pass --no-daemon argument to avoid exit the container.

Docker Pull Command
Owner
extralam