Introduction
In the earlier articles (Article 1 - Article 2 - Article 3), we learned about the usage and installation of Docker in a Windows application. Now let's start learning how to Dockerize NodeJs applications.

What is Docker?
Docker is an internal or integral part of DevOps (a clipped compound of "development" and "operations"). With its amazing architecture design tool, we can achieve major issues or exceptional use of Docker as a virtual machine. It is a platform for service products that create a virtual container that contains a collection of software. A container is a collection of software, libraries, configured files that communicate with each other with well-defined channels. Docker Containers are standalone, executable packages, lightweight collection of software which just need to run for use. The major thing is open-source, which is a software development solution known as containers.
The main purpose of Docker will let you run all the microservices with a distributed architecture.

Getting Started
Before moving forward to dockerize a NodeJs application, we need to configure and set-up the NodeJs application first.
Let's create a sample NodeJs application.
Step 1
Create a directory named myapp -> change directory -> run npm init command

Basically, it will create a folder name with myapp, in which the default `package.json` file will be created which will looks like below.

Step 2
Now install express as a dependency package.
Step 3
Add a new file named app.js and copy write code as below

Step 4
Run the app with the following command

Step 5
You can see your NodeJs application is running on 3000 port of localhost, Open http://localhost:3000/ in a browser to see the output.
So now our NodeJs application is created successfully, now let's dockerize the same app.
Dockerizing a Node.js web app
Step 1
Launch docker-machine or Docker Desktop so that docker services gets run















Join the conversation! Your thoughts help the community grow.