How To Deploy A Docker Based Web Application On Azure


Cloud providers facilitate an efficient way to run and deploy containerized applications with reduced cost of infrastructure. If you are running your application through containers, Microsoft Azure provides the facility to deploy such applications using azure app services.
In this article, I am going to cover how a Docker-based .NET Core web application can be deployed on Azure app services.
  1. Active Azure subscription
  2. Basic knowledge of docker and deploying web-based applications on Azure

Steps to deploy docker based web application on Azure app service 

Create an Azure container registry
First thing, We need to provide our Docker image to azure. The image can be provided through public repository like docker hub however it is recommended to use a private repository if you are working with corporate applications.
Azure provides an Azure container registry to register your image on Azure in a secure way.
In this step, we are going to create an azure container registry using CLI and store images on it so that it will be available to azure app services. Below is the command to create an Azure container registry
az acr create --name <container registry name > -g <resource group name > --sku <Basic>
You can use an existing resource group or can create a new resource group using the command:
az group create --name <resource group name> --location <region>

Create & Push image to Azure container registry

In order to create an image you have to give the tag of the image in below specific format
<registry name ><image name>:<version>
Version is optional, but it is good practice to give a version
Command to build an image,
docker build –t <registry name ><image name>:<version>
In case you have already created the image, you can tag that image in a specified format using the below command:
docker tag <image name> <registry name ><image name>:<version>
Before pushing the registry, you have to login into the Azure container registry using the below command:
az acr login -- name <acr name>
The last step is to push this image into the Azure container registry using the below command. It might take some time to push your image:
docker push <registry name ><image name>:<version>

Create Azure web apps for containers

Now you have an image published on azure container registry, Its time to create a container instance using Azure CLI. You can use your azure portal UI to do this as well, here I am demonstrating using the Azure CLI
Command to create container:
az container create --resource-group <resource group Name> --name <containername> --image <registry name><image name>: <version> --cpu 1 --memory 1 --registry-login-server <azure registry> --registry-username <username> --registry-password <password> --dns-name-label <app dns name> --ports <portnumber>
az container create --resource-group rgdocker --name container-001 --image --cpu 1 --memory 1 --registry-login-server --registry-username <username> --registry-password <pwd> --dns-name-label my-app --ports 5000

Access the running application

Once your container successfully created and started, you can directly access your app using the DNS name which was specified during the container creation in the previous step.
To access the application, you can directly hit the URL e.g. (
You can check logs of your container via the following command in case you want to troubleshoot.
az container logs -- resource-group <ResourceGroupName> — name <ContainerName>


Azure provides a platform to easily run and deploy the containerized application. It is efficiently maintaining the Azure container registry and easy to push the image on it.
Azure GUI provides a very nice interface to perform all tasks without using CLI.
I hope it will be helpful to you to jumpstart Docker along with the Azure cloud service provider.

Similar Articles