Skip to main content

Dockerizing a node.js application

Hands-On Lab


Photo of joel


Training Architect





Dockerizing a Node.js Application Welcome back, and great job on migrating the SpaceBones website from NGINX to Apache! President Squawk is very impressed with your skill, and now has another task lined up. As you probably noticed from the current national website, SpaceBones is not only in need of treats, but also in need of a bit of technological advancement. The Radar Board (The official SpaceBones government tech team) has requested your assistance with developing a Node.js web application that can be used for launching a new and improved SpaceBones webspace.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.


Using the example Dockerfile included in activity instructions, use Docker to build a new Node.js app image using the files under the content-dockerquest-spacebones/nodejs-app subdirectory, named baconator. Be sure to tag the image as dev. Good luck!

  • Clone the content-dockerquest-spacebones GitHub repo
git clone
  • Move into the nodejs-app subdirectory
cd ~/content-dockerquest-spacebones/nodejs-app
  • Use the Dockerfile below to build a new image
FROM node:7
COPY package.json /app
RUN npm install
COPY . /app
CMD node index.js
  • build container image
docker build -t baconator:dev .
  • (optional) Run the image to verify functionality
docker run -d -p 80:8081 baconator:dev