Docker Node Versus Ubuntu

I’m curious if there’s a preferred method for installing Node.

I’m reading the Docker Book by James Turnbull and in one example he’s pulling a Ubuntu image (FROM ubuntu:14.04) and then installing Node

Does this offer any advantages over just installing the Docker Node image (FROM node:latest)?

Thoughts welcome.

Thank you.

It depends on how much control you want over node js version and any additional tooling you need in you Docker image. If you look at Dockerfile for official node js image(, they use alpine as base. I personally prefer to use official images for production since that has been stress tested.

The ubuntu image contains some packages and libraries that you may need for node apps. But, I always use the official node images and then modify them as needed. For example:

I have to agree with the others, I always use official images if I can and I always select the Alpine version if available. Why use Alpine? Two reasons:

  1. Much small images. Ubuntu is 188MB alone. Then you add your app on top of that probably exceeding 200MB. Alpine Linux is only 4MB! After adding my Python runtime and code most of my images are only 52MB. Compare that will almost 200MB of Ubuntu. Smaller images are smaller upload/download and take up less disk space.

  2. Smaller attack surface! When you start from Ubuntu, you are adding lots of other services that may be running that are not needed and could be exploited. Alpine Linux has very little to attack so it is inherently more secure.

You don’t need an entire generic OS… all you need is a runtime for your app and nothing more. I always start with Alpine Linux when I’m building my own containers from scratch.