asp.net core in Docker container vs Azure App service asp.net core in Docker container vs Azure App service docker docker

asp.net core in Docker container vs Azure App service


Obvious reason to favor docker image over app service would be portability. If you want to switch to other cloud platform from Azure, you simply need to deploy your preconfigured docker image to other platform's container management service and it will just work there, whereas if you want to move your app from app service to some equivalent service offering in some other cloud platform, you'll need to spend time learning about how it works and then configuring it all over again in the new place.


Could anyone explain why would one choose deploying asp.net core app to docker container instead of azure app service?

All Azure Web App run in a secure environment called a sandbox. The sandbox mechanism aims to ensure that each app running on a machine will have a minimum guaranteed level of service; furthermore, the runtime limits enforced by the sandbox protects apps from being adversely affected by other resource-intensive apps which may be running on the same machine.

Since All Azure Web App run in the same type of sandbox. Azure Web App provide the multi features which related to deploying and monitoring your web application. For example Logging, Remote debugging, Kudu, Site extension etc.

Since All Azure Web App run in the same type of sandbox, The sandbox restrictions will affect your web application.

General Sandbox Restrictions

If the APIs or functions which used by your web app is not restricted by sandbox, you could choose Azure Web App to use the features/tools provided by Azure Web App. Otherwise, you could choose dock container.


Although Docker support is getting better, developing locally with Docker has issues, for example with time sync like this https://github.com/docker/for-win/issues/3168. There is better support those days, for example "Azure Dev Spaces" which make it possible to run a microservice in a cluster not running locally, so it removed the requirement to run all needed images on your laptop. There are many benefits for simplify deployment and management once a cluster is configured, but still I do not enjoy developing for.

I personally do not favor Kubernetes (AKS), Docker Swarm, etc.. It requires a cluster configuration and I would only recommend it in a large microservice architecture where people do not want to use serverless architecture like Azure Functions, but that is not really the question here. Not that easy, how to handle certificates and port binding? Docker storage, ever used Docker Data Volumes? It is not very friendly. Monitoring could be improved, what if something goes wrong, where to find more information? I find it hard.

Azure Web Apps offer good integration with Azure DevOps, deployment slots, Application Insights, Application Identity! (called MSI). Automatic certificate renewal using App Service Certificates, custom domains and so many developer utilities, attaching visual studio as debugger is so easy. Using the App Service Editor you can try out modifications in for example the Web.Config without the need to re-image your Docker image.

In my opinion: If you want no vendor lock in then go for Docker images, else go for Azure Function App v2 or Azure Web Apps.

My favor #1: Serverless

  • Azure -> Function App v2 (nice with Eventgrid and Logic Apps)
  • Amazon -> AWS Lambda

My favor #2: PaaS

  • Azure -> Azure Web Apps
  • Amazon -> AWS Elastic Beanstalk

else Docker

  • Azure -> Azure Kubernetes Service
  • Amazon -> Amazon Elastic Container Service / Amazon Elastic Kubernetes Service / AWS Fargate

I would not go for IaaS any more even though it offers most control overall.