Docker Node JS Hello World

Onexlab
4 min readFeb 17, 2022

In this article, we will create an application image for a Node JS API that uses the Express framework. You will learn how to build a container using that image to expose the API. We are creating only a single endpoint that will return Hello World Using Docker Node JS

Docker Node JS Hello World

Video

Let’s start

Prerequisite: Make sure you have installed the following

  1. Docker Desktop: To learn more about making sure you have installed the Docker Desktop. You can read our following post about installation and usage

2. Node JS: Make sure you have installed Node JS to test the app without Docker. We are using Node JS 16 version in the example

We are using only 3 following files for this example

  1. Dockerfile: To learn more about Dockerfile visit this link
  2. Index.js: Reference https://expressjs.com/en/starter/hello-world.html
  3. package.json: Reference https://docs.npmjs.com/cli/v7/configuring-npm/package-json

Docker File

Main File

--

--