Node.js on Docker.
This image is based on the Alpine Linux variant of the official Nodejs image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.
The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.
To minimize image size, it's uncommon for additional related tools (such as
bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the
alpine image description for examples of how to install packages if you are unfamiliar).
Installation and Usage
docker pull pagerinc/node docker run -it --rm pagerinc/node node
Currently, this node image comes in LTS flavor, tailored towards a specific use case.
latest: Node.js v6.11.0
Tests are run as part of the
Dockerfile build. To execute them separately within a container, run:
NODE_ENV is already set to
production for you. Any other secrets and runtime configuration need to be passed in to your application as well.
By default, Docker runs container as root which inside of the container can pose as a security issue. You would want to run the container as an unprivileged user wherever possible. This image provides the unprivileged
node user for such purpose.