Public Repository

Last pushed: 24 days ago
Short Description
Node.js server image
Full Description

Supported tags and respective Dockerfile links

  • latest, stable, 8, 8.2, 8.2.1, 8.2.1-r1 (Dockerfile)

Node.js Server

This is a container for running your own Node.js server. It also includes the following globally installed Node.js packages:

  • bunyan
  • node-gyp
  • npm
  • nsp
  • grunt-cli
  • gulp-cli

Prerequisites

  • Install Docker Compose on the system.
  • Review the documentation for Node.js Server for details on how to configure and use the product.
  • Choose a location on the system in which to store your Node.js application.

Container Setup

Follow the steps below to set up the container. These instructions assume you have chosen /opt/docker/nodejs as a base folder for storing settings and data. If you choose a different path, please update the path in the commands below accordingly.

  1. On the Docker host, create the docker-compose.yml file inside the /opt/docker/nodejs folder. The format is shown below in the Docker Compose Configuration section.
  2. Create the necessary configuration and data folders.
    • host# mkdir -p /opt/docker/nodejs/app
  3. Pull the latest image from the registry:
    • host# docker-compose pull nodejs
  4. Review the Container Initialization section below on how to configure the container to run your application.
  5. Use docker-compose to bring up the container:
    • host# docker-compose up nodejs

In the future, you can update the container by simply re-running docker-compose pull nodejs followed by docker-compose up --force-recreate nodejs. These commands will automatically pull the latest version of the image(s) from the registry and replace it without affecting your data or configurations.

Docker Compose Configuration

Below is a sample docker-compose.yml file for your reference:

#
# Sample configuration for 'nodejs' container
#

version: "3"

services:
  nodejs:
    container_name: nodejs
    image: dataknightllc/nodejs:stable
    volumes:
      - /opt/docker/nodejs/app:/var/lib/nodejs/app
    ports:
      - 80:80
      - 443:443
    environment:
      TZ: ${TZ:-UTC}
    command: /usr/local/bin/node /var/lib/nodejs/app/run.js

Backing Up the Container

Once you have configured the container per the instructions above, you simply need to backup the /opt/docker/nodejs folder and subfolders to save your configuration and data.

Container Initialization

This image contains no application data so you will need to mount a volume containing application files and run the appropriate node command to start the application.

The container image can also be used to run one-off node or npm commands as well.

If you do not override the default command, the container will just start a node shell and wait for commands.

Additional Help or Questions

If you have questions, find bugs or need additional help, please send an email to
support@dataknight.co.

Docker Pull Command
Owner
dataknightllc

Comments (0)