Dockerizing a Cesium node.js app

Today I found on GitHub a repository containing some samples for learning how to use Cesium 3D Tiles (

The sample we’re trying to run is the sample with the trees:


Getting the samples running on a machine can be a complicated task, because all the development dependencies have to be installed correctly.

With some Docker magic getting the samples up and running  will be really easy, so let’s investigate how to do this.

When inspecting the code (see, its clear that it’s a Node.js app (see package.json), running on port 8003 (see server.js).

I’ve forked the repository (see, and made the following changes:

– added index.html (, containing the sample app;

– added  a Dockerfile (see


The Dockerfile does the following things:

– It’s based on node:10 image;

– it copies package.json and runs ‘npm install’ to get all the dependencies;

– It copies the application files (index.html, index.js, server.js and a tileset with trees)

– It opens port 8004 (the sample now will run on 8004 instead of 8003 as before)

– It starts the application (with ‘npm start’)


To build the image run on a terminal:

$ docker build -t bertt/cesium_trees .


To run the image:

$ docker run -it -p 8004:8004 bertt/cesium_trees


Navigate to http://localhost:8004 and the application will show up:


The Docker image is published on Docker hub ( so you can also get the application from there.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s