SlideShare a Scribd company logo
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 1
This documentation explains step by step how to Build, Deploy and Run Node.js application on
Azure using docker.
The following Source code will be used as test and can be checked from here.
Requirements:-
• Azure Account (Sign up for a free $200 credit)
• Git (Install on the computer)
• Docker (Install on the computer)
• Node.js (you can use the above link to clone the code).
Let’s work !!!
Step #1:-
After logging to the Azure account, as initial step we must create something called container
registry ( ACR will be used later as refer to Azure container Registry) which allows you to store
your custom container images privately in the Azure cloud.
Access to azure portal from the following link :- https://portal.azure.com/
Figure 1 Create container Registry
Then After access the container registry page, press add
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 2
Figure 2 add ACR Screen
And fill the information depends on the requirement you have.
Figure 3 Create ACR
And Press create.
Wait for couple of second/minute till it will be created, azure will notify you (Notification
section) once it’s completed.
Step #2:-
Once the ACR will be created, press on it, and it will take you to the information about the
created ACR, the following information will be needed later.
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 3
Figure 4 ACR Login information
Step #3:-
We need to check the docker login, open Power shell/terminal depends on operating system
you are using, to authenticate to ACR and validate the credentials.
Figure 5 Test docker Login using ACR information
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 4
Figure 6 Test Result, Login Succeeded
You should see a message that says, “login succeeded”. As Figure 6.
Step #4:-
We need to clone the sample code from
https://bitbucket.org/network-international/node-js-getting-started/src/master/
Git command should be installed, to do this just press on this link here.
Fire the below command on the PowerShell/terminal/command promote.
git clone https://github.com/heroku/node-js-getting-started.git
Figure 7 Using Git to clone the code
After you've cloned the repo, switch into the application directory:
You will find files, create file call it Dockerfile (without any extension).
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 5
Figure 8 Dockerfile inside cloned repo
Inside the file write the following :-
Descriptions : -
• FROM node:alpine, The FROM command defines the base container image, and the
operating system will be Alpine Linux.
• WORKDIR /usr/app define the working directory and is where we'll store the application
code and if it’s not exists on the OS will be created during the process.
• COPY package*.json ./ used during the build process to add the package.json and
package-lock.json files to the working directory.
• RUN npm install used to execute npm install which will ensure our application
dependencies are included within the container image.
• COPY . . this is to copy the application source files into the working directory.
• CMD ["npm", "start"] defines the default command to execute when the container
starts.
Step #5:-
To do this step, you should be in the same directory as the Dockerfile. Use the docker build
command to create your container image, the below command will tell Docker to build your
image using the Dockerfile in the current directory.
FROM node:alpine
WORKDIR /usr/app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "start"]
docker build -t demonetwork.azurecr.io/node-docker-demo:latest .
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 6
Figure 9 Build docker image using dockerfile
Step #6:-
Now we test the login to our docker before, let’s push our image to ACR using the below
command,
Figure 10 Push the docker Image to ACR
docker push demonetwork.azurecr.io/node-docker-demo:latest
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 7
Figure 11 Pushing the docker image completed
After the command completes successfully, you can head back to the Azure portal to verify that
your image is now available in ACR.
Figure 12 Verify the command
Step #7:-
The final step, which is expose the docker application using URL, Azure make this step easy, by
creating resource called Web App for containers, to do this just follow the below figures.
In the Azure portal, select Create a resource, select Web in the Azure Marketplace, and choose
Web App for containers.
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 8
Figure 13 Create web app for containers
Press on web app for containers
Figure 14 Create Web App for containers
New page will be open, fill the information, such as the name of instance, will be publish either
on Linux or docker container ( our case) , don’t press review + create, press Next: Docker, so you
will be able to configure the web app.
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 9
Figure 15 Web App Instance details
The next screen, which is docker, as you see, I choose “ azure container Registry” and from the
drop list, will be appeared our options.
Figure 16 web app container configuration
Press review creates.
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 10
Figure 17 Web App Summary Page
Wait for couple of seconds and it will be created.
Figure 18 Final Result with URL for the new deployed code
As you see if you check the URL and press on it
This is the result.
https://networktask.azurewebsites.net
Build, Deploy and Run Node Js Application on Azure using Docker
Osama Mustafa P a g e | 11

More Related Content

PPTX
Jenkins CI/CD setup for iOS in Mac OSX
PPTX
Sexy, Powerful, Exciting
PDF
Deploy Angular to the Cloud (ngBucharest)
PPTX
Use case 1 - for Sitecore Automation Module
PDF
Cloud and Ubiquitous Computing manual
PPTX
Jenkins and AWS DevOps Tools
PDF
Sitecore Docker XM&XP 9.2.0/9.3.0 SXA+JSS+PS
PDF
Boosting Sitecore Development With Sitecore Docker
Jenkins CI/CD setup for iOS in Mac OSX
Sexy, Powerful, Exciting
Deploy Angular to the Cloud (ngBucharest)
Use case 1 - for Sitecore Automation Module
Cloud and Ubiquitous Computing manual
Jenkins and AWS DevOps Tools
Sitecore Docker XM&XP 9.2.0/9.3.0 SXA+JSS+PS
Boosting Sitecore Development With Sitecore Docker

What's hot (17)

DOCX
SELENIUM SCRIPTS FOR DASHBOARD UI
PPTX
Java – azure integration
PDF
New features of Azure Cloud Provider in OpenShift Container Platform 3.10
PPTX
Setup a Dev environment that feels like $HOME on Windows 10
PDF
Troubleshooting EC2- Linux Server Configuration
PDF
SDAccel Design Contest: How to use SDAccel on AWS
PPTX
15-ways-to-optimize-spring-boot-for-the-cloud
PPTX
Unity and Azure Mobile Services using Prime31 plugin
PDF
Jenkins Setup Document
PPTX
15 ways-to-optimize-spring-boot-for-the-cloud
PDF
Ionic2
PDF
New features of Azure Cloud Provider at OCP 3.10
PDF
ApppiumDoc_version2015
PDF
Midas - on-the-fly schema migration tool for MongoDB.
PPTX
Docker on Windows - 101 to Production (half-day workshop)
PPTX
"Don’t Run with Scissors: Serverless Security Survival Guide" | Hillel Solow,...
PPT
Php ppt
SELENIUM SCRIPTS FOR DASHBOARD UI
Java – azure integration
New features of Azure Cloud Provider in OpenShift Container Platform 3.10
Setup a Dev environment that feels like $HOME on Windows 10
Troubleshooting EC2- Linux Server Configuration
SDAccel Design Contest: How to use SDAccel on AWS
15-ways-to-optimize-spring-boot-for-the-cloud
Unity and Azure Mobile Services using Prime31 plugin
Jenkins Setup Document
15 ways-to-optimize-spring-boot-for-the-cloud
Ionic2
New features of Azure Cloud Provider at OCP 3.10
ApppiumDoc_version2015
Midas - on-the-fly schema migration tool for MongoDB.
Docker on Windows - 101 to Production (half-day workshop)
"Don’t Run with Scissors: Serverless Security Survival Guide" | Hillel Solow,...
Php ppt
Ad

Similar to Build, Deploy and Run Node Js Application on Azure using Docker (20)

PDF
Build containerized application using Docker and Azure.pdf
PDF
Rome .NET Conference 2024 - Remote Conference
PDF
Create your first application node.js and windows azure
PPTX
Moving Applications into Azure Kubernetes
PPTX
Deploying Containers on Azure
PDF
.NET Fest 2019. Alex Thissen. Architecting .NET solutions in a Docker ecosystem
PPTX
Realtime Conf - Lightning node.js dev
PPTX
GlobalAzureBootCamp 2018
PPTX
Dockerization of Azure Platform
PPTX
Provisioning, deploying and debugging node.js applications on azure
PPTX
Setup docker on existing application
PPTX
Build Once, Run Anywhere: The Rise of Containerization in Modern IT
PPTX
Codemotion Azure Container Apps
PPTX
Kubernetes VS. App Service: When the orchestrator challenges the platform
PPTX
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
PDF
Azure-Container-Apps.pdf
PPTX
Docker + Node "hello world" Application
PPTX
Using Azure DevOps to continuously build, test, and deploy containerized appl...
PDF
Kubernetes vs App Service
PDF
Running Containers on Azure
Build containerized application using Docker and Azure.pdf
Rome .NET Conference 2024 - Remote Conference
Create your first application node.js and windows azure
Moving Applications into Azure Kubernetes
Deploying Containers on Azure
.NET Fest 2019. Alex Thissen. Architecting .NET solutions in a Docker ecosystem
Realtime Conf - Lightning node.js dev
GlobalAzureBootCamp 2018
Dockerization of Azure Platform
Provisioning, deploying and debugging node.js applications on azure
Setup docker on existing application
Build Once, Run Anywhere: The Rise of Containerization in Modern IT
Codemotion Azure Container Apps
Kubernetes VS. App Service: When the orchestrator challenges the platform
Architecting .NET solutions in a Docker ecosystem - .NET Fest Kyiv 2019
Azure-Container-Apps.pdf
Docker + Node "hello world" Application
Using Azure DevOps to continuously build, test, and deploy containerized appl...
Kubernetes vs App Service
Running Containers on Azure
Ad

More from Osama Mustafa (20)

PDF
Case study for software architect
PPTX
DevOps for database
PPTX
Does cloud mean the end of the dba
PDF
Using git hub for your code
PDF
DevOps Project
PDF
Java business service
PDF
Steps creating data_integration_services
PDF
Oracle api gateway installation as cluster and single node
PDF
Helping implementer dealing with famous siebel based system messages and er...
PPTX
Weblogic and docker
PPTX
Weblogic 101 for dba
PDF
Ebs clone r12.2.4
PDF
Oracle obia 11.1.1.10.1 installation
PDF
Oracle Enterprise manager 13c Installation
PDF
Erp installation r12.2
PDF
OBIA Installation
DOCX
Upgrade EBS DB from 11g to 12c.
PPTX
Eouc 12 on 12c osama mustafa
PDF
Install oracle siebel on windows 2008 r2
PDF
Enable oracle database vault
Case study for software architect
DevOps for database
Does cloud mean the end of the dba
Using git hub for your code
DevOps Project
Java business service
Steps creating data_integration_services
Oracle api gateway installation as cluster and single node
Helping implementer dealing with famous siebel based system messages and er...
Weblogic and docker
Weblogic 101 for dba
Ebs clone r12.2.4
Oracle obia 11.1.1.10.1 installation
Oracle Enterprise manager 13c Installation
Erp installation r12.2
OBIA Installation
Upgrade EBS DB from 11g to 12c.
Eouc 12 on 12c osama mustafa
Install oracle siebel on windows 2008 r2
Enable oracle database vault

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation theory and applications.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Approach and Philosophy of On baking technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Electronic commerce courselecture one. Pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
KodekX | Application Modernization Development
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
Understanding_Digital_Forensics_Presentation.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation theory and applications.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Per capita expenditure prediction using model stacking based on satellite ima...
Approach and Philosophy of On baking technology
Review of recent advances in non-invasive hemoglobin estimation
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Machine learning based COVID-19 study performance prediction
Electronic commerce courselecture one. Pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Unlocking AI with Model Context Protocol (MCP)
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Network Security Unit 5.pdf for BCA BBA.
KodekX | Application Modernization Development
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Building Integrated photovoltaic BIPV_UPV.pdf

Build, Deploy and Run Node Js Application on Azure using Docker

  • 1. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 1 This documentation explains step by step how to Build, Deploy and Run Node.js application on Azure using docker. The following Source code will be used as test and can be checked from here. Requirements:- • Azure Account (Sign up for a free $200 credit) • Git (Install on the computer) • Docker (Install on the computer) • Node.js (you can use the above link to clone the code). Let’s work !!! Step #1:- After logging to the Azure account, as initial step we must create something called container registry ( ACR will be used later as refer to Azure container Registry) which allows you to store your custom container images privately in the Azure cloud. Access to azure portal from the following link :- https://portal.azure.com/ Figure 1 Create container Registry Then After access the container registry page, press add
  • 2. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 2 Figure 2 add ACR Screen And fill the information depends on the requirement you have. Figure 3 Create ACR And Press create. Wait for couple of second/minute till it will be created, azure will notify you (Notification section) once it’s completed. Step #2:- Once the ACR will be created, press on it, and it will take you to the information about the created ACR, the following information will be needed later.
  • 3. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 3 Figure 4 ACR Login information Step #3:- We need to check the docker login, open Power shell/terminal depends on operating system you are using, to authenticate to ACR and validate the credentials. Figure 5 Test docker Login using ACR information
  • 4. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 4 Figure 6 Test Result, Login Succeeded You should see a message that says, “login succeeded”. As Figure 6. Step #4:- We need to clone the sample code from https://bitbucket.org/network-international/node-js-getting-started/src/master/ Git command should be installed, to do this just press on this link here. Fire the below command on the PowerShell/terminal/command promote. git clone https://github.com/heroku/node-js-getting-started.git Figure 7 Using Git to clone the code After you've cloned the repo, switch into the application directory: You will find files, create file call it Dockerfile (without any extension).
  • 5. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 5 Figure 8 Dockerfile inside cloned repo Inside the file write the following :- Descriptions : - • FROM node:alpine, The FROM command defines the base container image, and the operating system will be Alpine Linux. • WORKDIR /usr/app define the working directory and is where we'll store the application code and if it’s not exists on the OS will be created during the process. • COPY package*.json ./ used during the build process to add the package.json and package-lock.json files to the working directory. • RUN npm install used to execute npm install which will ensure our application dependencies are included within the container image. • COPY . . this is to copy the application source files into the working directory. • CMD ["npm", "start"] defines the default command to execute when the container starts. Step #5:- To do this step, you should be in the same directory as the Dockerfile. Use the docker build command to create your container image, the below command will tell Docker to build your image using the Dockerfile in the current directory. FROM node:alpine WORKDIR /usr/app COPY package*.json ./ RUN npm install COPY . . CMD ["npm", "start"] docker build -t demonetwork.azurecr.io/node-docker-demo:latest .
  • 6. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 6 Figure 9 Build docker image using dockerfile Step #6:- Now we test the login to our docker before, let’s push our image to ACR using the below command, Figure 10 Push the docker Image to ACR docker push demonetwork.azurecr.io/node-docker-demo:latest
  • 7. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 7 Figure 11 Pushing the docker image completed After the command completes successfully, you can head back to the Azure portal to verify that your image is now available in ACR. Figure 12 Verify the command Step #7:- The final step, which is expose the docker application using URL, Azure make this step easy, by creating resource called Web App for containers, to do this just follow the below figures. In the Azure portal, select Create a resource, select Web in the Azure Marketplace, and choose Web App for containers.
  • 8. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 8 Figure 13 Create web app for containers Press on web app for containers Figure 14 Create Web App for containers New page will be open, fill the information, such as the name of instance, will be publish either on Linux or docker container ( our case) , don’t press review + create, press Next: Docker, so you will be able to configure the web app.
  • 9. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 9 Figure 15 Web App Instance details The next screen, which is docker, as you see, I choose “ azure container Registry” and from the drop list, will be appeared our options. Figure 16 web app container configuration Press review creates.
  • 10. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 10 Figure 17 Web App Summary Page Wait for couple of seconds and it will be created. Figure 18 Final Result with URL for the new deployed code As you see if you check the URL and press on it This is the result. https://networktask.azurewebsites.net
  • 11. Build, Deploy and Run Node Js Application on Azure using Docker Osama Mustafa P a g e | 11