Public Repository

Last pushed: a month ago
Short Description
OpenShift S2I builder images for Node.js applications
Full Description

OpenShift Builder Images for Node.js Applications

This repository contains sources for an s2i builder image, based on CentOS7 and Node.js releases from

For more information about using these images with OpenShift, please see the
official OpenShift Documentation.


Node.js versions currently provided:

<!-- versions.start -->

  • 8.4.0: (8.x, latest)
  • 7.10.1: (7.x)
  • 6.11.2: (6.x, Boron)
  • 5.12.0: (5.x)
  • 4.8.4: (4.x, Argon)

    <!-- versions.end -->


Using this image with OpenShift oc command line tool, or with s2i directly, will
assemble your application source with any required dependencies to create a new image.
This resulting image contains your Node.js application and all required dependencies,
and can be run either by OpenShift Origin or by Docker.

The oc command-line tool can be used to start a build, layering your desired nodejs REPO_URL sources into a centos7 image with your selected RELEASE of Node.js via the following command format:

oc new-app bucharestgold/centos7-s2i-nodejs:RELEASE~REPO_URL

For example, you can run a build (including npm install steps), using s2i-nodejs example repo, and the latest release of
Node.js with:

oc new-app bucharestgold/centos7-s2i-nodejs:latest~

<!-- Or, to run the latest `lts-6` release: ``` oc new-app bucharestgold/centos7-s2i-nodejs:lts-6~ ``` You can try using any of the available tagged Node.js releases, and your own repo sources - as long as your application source will init correctly with `npm start`, and listen on port 8080. -->

Environment variables

Use the following environment variables to configure the runtime behavior of the
application image created from this builder image.

NAME Description
NPM_RUN Select an alternate / custom runtime mode, defined in your package.json file's scripts section (default: npm run "start")
NPM_MIRROR Sets the npm registry URL
NODE_ENV Node.js runtime mode (default: "production")
HTTP_PROXY use an npm proxy during assembly
HTTPS_PROXY use an npm proxy during assembly

One way to define a set of environment variables is to include them as key value pairs
in a .s2i/environment file in your source repository.

Example: DATABASE_USER=sampleUser

Using Docker's exec

To change your source code in a running container, use Docker's exec command:

docker exec -it <CONTAINER_ID> /bin/bash

After you Docker exec into the running container, your current directory is set to /opt/app-root/src, where the source code for your application is located.

Using OpenShift's rsync

If you have deployed the container to OpenShift, you can use oc rsync to copy local files to a remote container running in an OpenShift pod.


The Source2Image cli tools are available as a standalone project, allowing you to run builds outside of OpenShift.

This example will produce a new docker image named webapp:

s2i build bucharestgold/centos7-s2i-nodejs:current webapp


There are several ways to make this base image and the full list of tagged Node.js releases available to users during OpenShift's web-based "Add to Project" workflow.

For OpenShift Online Next Gen Developer Preview

Those without admin privileges can install the latest Node.js releases within their project context with:

oc create -f

To ensure that each of the latest Node.js release tags are available and displayed correctly in the web UI, try upgrading / reinstalling the image stream:

oc delete is/centos7-s2i-nodejs ; oc create -f

If you've (automatically) imported this image using the oc new-app example command, then you may need to clear the auto-imported image stream reference and re-install it.

For Administrators

Administrators can make these Node.js releases available globally (visible in all projects, by all users) by adding them to the openshift namespace:

oc create -n openshift -f

To replace the default SCL-packaged openshift/nodejs image (admin access required), run:

oc delete is/nodejs -n openshift ; oc create -n openshift -f

Building your own Builder images

Clone a copy of this repo to fetch the build sources:

git clone
cd origin-s2i-nodejs

Requirements - docker-squash

pip install docker-squash

To build your own S2I Node.js builder images from scratch, run:

make all
Docker Pull Command

Comments (0)