An Ubuntu 14.04 based image, featuring s6 process management and Node.js.
1.5K
An image for using Node.js within containers.
It's built from my Ubuntu-based Docker image (with s6).
To use this image include FROM smebberson/nodejs at the top of your Dockerfile. Inheriting from smebberson/ubuntu-base provides you with the ability to easily start your node.js application using s6. s6 will also keep it running for you, restarting it when it crashes.
To start your app using s6:
/etc/s6/app (or name it whatever you like, just make sure it lives within /etc/s6)run and give it execute permissions#!/usr/bin/env bash
# cd into our directory
cd /app
# start our node.js application
exec node server.js;
When you run this container, s6 will automatically start your application and make sure it stays running for you.
You'll also need to make sure you go through the usual process of adding your node.js source, installing your packages with npm and exposing the necessary ports for your application.
If you're logging to stdout (which console.log does) then you'll be able to review your logs using the standard Docker process.
The best way to handle exceptions is to:
This will ensure that your errors aren't going un-noticed, but that your application stays up and in proper functioning order. An example of this is:
process.on('uncaughtException', function (e) {
console.log(e);
process.exit(1);
});
Content type
Image
Digest
sha256:a4757fb8d…
Size
142.3 MB
Last updated
over 11 years ago
docker pull smebberson/nodejs