Deploying Monolithic Applications as Containers on Azure
The article explains how to containerize monolithic web applications, manage and scale them using Azure services and Docker, discusses the trade‑offs of a monolithic‑in‑a‑container approach, and provides practical steps for publishing containerized apps to Azure App Service.
You may need to build a standalone web application or service and deploy it as a single container, even though the application consists of multiple libraries, components, or layers (application, domain, data‑access, etc.) that are internally modular.
To manage this model, you can deploy one container representing the whole application; scaling is achieved by adding more replica containers behind a load balancer, keeping management simple by handling a single deployment per VM or container.
A container can host multiple components, libraries, or internal layers as shown in the figure; most functionality of a monolithic containerized app lives inside one container, and the container can be cloned across many servers/VMs for scaling. Although this contradicts the principle that a container should do one thing, it can be acceptable in certain scenarios.
When the application grows, the drawback of this approach becomes evident: usually only a small subset of the code is the scaling bottleneck, while the rest is lightly used.
For example, in a typical e‑commerce system you might need to scale the product‑information subsystem because many more customers browse products than complete purchases; other functions such as checkout, comments, or purchase‑history receive far less traffic.
Various techniques exist to horizontally replicate parts of an application, partition business concepts or data, but changing a single component still requires full retesting and redeployment of all instances.
The monolithic‑in‑a‑container approach is common because it is initially easier to develop than a micro‑services architecture; many organizations adopt it, achieving satisfactory results, while others eventually hit scaling limits.
From an infrastructure perspective, a single server can run multiple applications, achieving acceptable resource‑usage ratios, as illustrated in the second diagram.
In Microsoft Azure, a monolithic app can be deployed on dedicated VMs per instance, using Azure Virtual Machine Scale Sets for easy scaling, or on Azure App Service, which can also run single‑instance Docker containers since 2016.
For QA or limited production environments you can deploy multiple Docker‑host VMs and balance them with an Azure Load Balancer, managing scaling at a coarse granularity because the whole app resides in one container.
Traditional deployment tools (Docker run, Docker Compose) can be used manually or automated via continuous‑delivery pipelines.
Deploying Monolithic Applications as Containers
Container‑based deployment offers many benefits: scaling containers is much faster and easier than scaling VMs; Docker images start in seconds, and stopping a container is almost instantaneous.
Because containers are immutable by design, you avoid issues with corrupted VMs or missed configuration steps during updates.
While the monolithic approach can benefit from Docker, the real advantage comes when combined with an orchestrator that manages each container’s lifecycle, allowing you to break the monolith into independently scalable subsystems—a stepping stone toward micro‑services.
Publishing a Single Container‑Based Application to Azure App Service
Azure App Service provides a simple way to host a single‑container application with built‑in scaling; it integrates tightly with Git and Visual Studio, enabling you to build code in VS and deploy directly to Azure.
If Docker is unavailable or you need features not supported by Azure App Service, you may need to switch to Azure Cloud Services or VMs where you have full control over installed components.
Visual Studio’s container support (2017+) lets you include any required dependencies in a Dockerfile or image.
The publishing flow pushes the image to a container registry—Azure Container Registry, Docker Hub, or a private registry—before Azure App Service pulls and runs it.
For more community resources and discussions, see the promotional table below (community groups, QQ, WeChat, etc.).
Architects Research Society
A daily treasure trove for architects, expanding your view and depth. We share enterprise, business, application, data, technology, and security architecture, discuss frameworks, planning, governance, standards, and implementation, and explore emerging styles such as microservices, event‑driven, micro‑frontend, big data, data warehousing, IoT, and AI architecture.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.