<img src="https://secure.leadforensics.com/133892.png" alt="" style="display:none;">

In my previous article in the series we learned how we host our custom image on dockers hub registry. In this blog we will look into how we can host it to Azure WebApp for containers.

Azure WebApp for containers is part of App service Plan and allows us to run containerized applications to host on windows and Linux. You can pull container images from Azure Container Registry, Docker Hub or a private Docker repository. This provides us flexibility that we can run our own custom images with custom logic and frameworks on WebApps. There is an preview feature available, that is deployment of multiple containers using docker compose on Linux. In the next article we will look into how we can run application that will use multiple containers using Azure Container Registry.

Just a note to remember that there are also other services in Azure to host containers like Azure Container Instances and powerful Azure Kubernetes services (AKS) but today's article is about WebApp for containers for the following reasons:

  • Teams (developers) are already more familiar with Azure web apps environments.
  • Already utilizing built-in features of App service plan (load balancing/Auto scale etc.).
  • DevOps CI/CD deployments already in place (few modifications might needed).
  • Light weight Container/Containers and need simple orchestration.
  • Need tighter isolation of not only code but packages, runtime framework, tooling etc.
  • Demo or POC applications on low cost or shared app plans.
  • Wonderful for testing as Sandbox or UAT environments for developers.
  • Wonderful debugging experience both for Visual studio (built-it) or Visual Studio Code.
  • Can be many others … (please share your thoughts in comments).

Now let’s jump into creating the WebApp for containers and required components through Azure CLI and using bash. If you are unsure how to use Azure CLI please follow this.

Create WebApp for Containers

1. Create resource within region, for example West Europe.

az group create --name Dynamic365RG --location westeurope --tags "Demo=WAC"

2. Create a Linux app plan.

 az appservice plan create -n linuixappplan -g Dynamic365RG --is-linux

3. Now we create a webapp to run our public image from Docker hub repository.

az webapp create -n devopswebapp -g Dynamic365RG -p linuixappplan -i yesadahmed/azuredevopsapipat:version1.0

Please note yesadahmed/azuredevopsapipat: version1.0 is my custom image on my docker's hub registry. Please feel free you use your own or any image.

Now everything is up and running under resource Dynamic365RG in azure portal.

Now if we go back to our WebApp hits its URL in azure portal, we will have our .Net core 3.1 WebAPI running on container. Note the URL hosted on azure webapp.

Now we can also see the logs in the container’s setting blade (as shown above).

Handle automatic updates(pushes) to WebApp:

Let's enable (turn on) continuous deployment button on webapp container settings blade to receive automatic updates on our azure WebApp. Means whenever we push(git) any change to our actual container in docker’s hub repository they are automatically applied to our WebApp. Isn't amazing, think if we have product and we are deploying its feature to clients so rapidly.

Now copy the webhook URL from container’s setting blade and paste into the dockers hub webhooks.

That’s it, now whenever there is change in our container in dockers then our WebApp in azure will be updated accordingly and show the results.

Great, isn’t with in no time we have our application running on single container. Another cool benefit is that the WebApp KUDU SCM site (developers) runs in separated container from the main WebApp. More info here.

Debugging Containers

Worth to note, that there is a great built-in support for debugging code in containers in visual studio and as well as in visual studio code. You can refer to my previous article and also here are some links to get started:

https://docs.microsoft.com/en-us/visualstudio/containers/edit-and-refresh?view=vs-2019

 https://code.visualstudio.com/docs/containers/debug-common

https://code.visualstudio.com/docs/containers/debug-netcore

In the next article we will look into how we can use Azure Container Registry to host our custom images instead of Docker’s hub repository.

Happy Coding!

Les også "Guide til et vellykket CRM-prosjekt"

Abonner på bloggen!

Diskuter dette innlegget

Tips til lesing

Landskapet markedsførere opererer i gjennomgår dramatiske forandringer som en konsekvens av AI-revolusjonen vi opplever i dag. Samtidig er kundenes forventninger stadig i endring. Hvordan kan kunstig intelligens og maskinlæring hjelpe deg som markedsfører med å navigere i denne nye virkeligheten og effektivt nå dine kommunikasjons- og konverteringsmål?
We are constantly maturing as consumers in digital sales channels and place higher demands on good user experiences. Therefore, we have developed a health check where we map the quality of user experiences and the user-friendliness of e-commerce solutions.
It is always great to find ways to enhance our productivity and creativity. One such way is by integrating ourselves with advanced technologies like GPT (Generative Pre-trained Transformer). I am going to share my journey of working alongside GPT as a team, focusing on how it has added and increased my abilities and helped me deliver on various work tasks. I am sharing examples of how I use GPT throughout the day and the process I follow to become one with GPT. I have built my own GPT co-pilot setup with various Python applications and integrations, bringing automation to the next level. But all the examples below can be executed without any such extra automation setup.
Er du klar for å la kunstig intelligens skrive møtereferatene og epostene dine? Det kan du nemlig gjøre nå.
Welcome to the exhilarating world of the AI revolution! In this blog series we will dive deep into the most relevant and fascinating topics to help you achieve great results with AI for your business. Lately, AI has been dominating the headlines, creating a whirlwind of buzz that's hard to keep up with. In this first blog we are giving a quick insight to the current status!
right-arrow share search phone phone-filled menu filter envelope envelope-filled close checkmark caret-down arrow-up arrow-right arrow-left arrow-down