Dockerized Node.js APP Using Azure Web App for Docker Containers

Akshay Krison
5 min readMar 24, 2022

“Developer Friendly Deployment Doc’s”

This article is focused on the deployment of NodeJs Application in Azure APP’s using Containerization by Docker in development mode.

Prerequisites to Proceed Further

  1. Basic in NodeJs
  2. Basic in Linux Commands [Am describing based on Linux Machine]
  3. Docker Installed System and Basic Build,Push command
  4. DockerHub Account
  5. Azure Account

Create and Dockerize Your NodeJs Application

Clone the below repo for the demo code in Nodejs usign the below link

https://github.com/AkshayKrison/demo-node-docker-azure.git

Next you have to Install the Docker in your System and Open the terminal from root of your project and build the docker image using the below command

docker build -t akshaykrisondevops/demo-node-docker-azure .

here you can change the name akshaykrisondevops as you like i name it as since my dockerhub as same username

Wait until the build complete..

Check you have got successful message while building the image and neglect the warnings, Also do a check in image after the build completion by using the below command

docker images 

DockerHub Account & Repository Creations

If you saw the above image like your docker image is successful build and ready to push in DockerHub. So create a account in DockerHub and create a docker repository by Clicking the Create Repository button.

Name the repository of the project as same as the image build-ed in above since we use same name we can avoid the confusion based on the names. Then change the Visibility to Private and Click on the Create button to create the repository in DockerHub. [ DockerHub Repository is used to Push the Locally Build-ed images.]

After creating the DockerHub account & Repository go to the Terminal and Login the DockerHub through CLI

docker login

Enter the DockerHub Username and Password and will show a Login Succeeded alert

Docker Image Push To DockerHub

Next check the docker images we have build-ed by running the below commands

docker images

Then Next we want to push the docker image to DockerHub for that run the below command

docker push <reposiroy_name>:latest

for my case,

docker push akshaykrisondevops/demo-node-docker-azure:latest

Wait until the push complete after the push complete you can check the image is pushed inside the DockerHub by going to the Web DockerHub console you can saw the images with latest tag…

Azure Web APP Creations

Go to the Azure Console and Click on the APP Service and Create a New APP service which navigate the APP service Creation Page(as like below) which has several procedures to do…

APP service Creation

Next you have to Create the Resource groups for azure which help us to make all the resource we have created under different groups as we need. Click on the Create New and Name the Resource Group you want to create. here am Creating a Group of Name “DockerNode”

Resource Group Creation

Next Input the Instance Details Like the Name of the Instance, Publishing Type,Operating System, Region etc..

  1. Name: here i give akshaykrison as server name
  2. Publish: Since the deployment is based on sing the Docker Container choose Docker Container
  3. Operating System: Choose Linux OS
  4. Region: Choose your desired region here am using Central US [which has most resources are available]

Then scroll down

Next Click on the Sku and Size in that Click on the Change Size to reduce the Instance Size and Cost [By default azure gives lager server so we have to reduce the Size so that click on the Change size and will get a screen like the below image in that choose the instance type as you need click Apply and Click on the Next

Which will Navigate you to The Docker Details. Here we have to make the docker configurations since we are deploying based on the docker.

  1. Options: Choose Single Container Deployment
  2. Image Source: Choose DockerHub
  3. Access Type: Private [Since my DockerHub image is in Private mod]
  4. Username: Input DockerHub Username
  5. Password: Input DockerHub Password
  6. Image and tag: Input the Docker image name with tag in DockerHub
  7. Startup Command: Skip this we dont use any startup command for Single container deployment

Then Click on the Next

Which Navigate you to the monitor section make all by default one and click Next and for Tag also Make all by default and Click Next

Which will Navigate a Review and Create option in that Click Create to Create the Web APP

Wait until the deployment and Creation Complete… Once the Deployment Complete click on the Go to resource button

Which will Navigate to the Resource page from that we can get overview of the APP we have newly created and Click on the Browse to Check the Deployment Completed and Load the Nodejs Web APP

If All done success you will get a page like below in browser….

--

--