Containers on Azure: Azure Container Registry, Container Instances, Container Apps and Azure Kubernetes Service (AKS)
Containers in Brief
- A container packages an app with its dependencies, so it runs the same everywhere
- A registry stores container images
- An orchestrator such as Kubernetes runs many containers, scales and heals them
Azure Container Registry (ACR)
bash
az acr create -g rg-cont -n acrshop482 --sku Standard
az acr build -r acrshop482 -t shop:v1 . # build in the cloud, no local Docker needed
az acr repository list -n acrshop482 -o table
az acr login -n acrshop482
- Tiers: Basic, Standard, Premium (Premium adds geo-replication, private link and content trust)
- Use **managed identity or RBAC (
AcrPull)** instead of admin passwords - Scan images with Microsoft Defender for Containers
Azure Container Instances (ACI)
- Run a container in seconds with no VM or cluster, billed per second
- Good for simple apps, jobs, build agents and burst capacity
- Not for complex scaling and service discovery
bash
az container create -g rg-cont -n hello-aci --image mcr.microsoft.com/azuredocs/aci-helloworld --dns-name-label hello-482 --ports 80 --cpu 1 --memory 1.5
az container logs -g rg-cont -n hello-aci
Azure Container Apps
- Serverless containers built on Kubernetes, with no cluster to manage
- Scale to zero and event-driven scaling with KEDA (HTTP, queues, Event Hubs, cron)
- Built-in ingress, revisions with traffic splitting, Dapr for microservice building blocks, jobs, secrets and managed identity
- Best for microservices and APIs without Kubernetes skills
bash
az containerapp env create -g rg-cont -n cae-shop -l centralindia
az containerapp create -g rg-cont -n api --environment cae-shop --image acrshop482.azurecr.io/shop:v1 \
--registry-server acrshop482.azurecr.io --registry-identity system --target-port 8080 --ingress external \
--min-replicas 0 --max-replicas 10 --scale-rule-name http --scale-rule-type http --scale-rule-http-concurrency 50
Azure Kubernetes Service (AKS)
- Managed Kubernetes: Azure runs the control plane (free or with an uptime SLA), you manage node pools
- Automatic SKU (AKS Automatic) gives opinionated, hands-off setup. Standard gives full control
- Node pools use VM Scale Sets. Use system pools for core pods and user pools for apps (Linux or Windows, GPU, Spot)
bash
az aks create -g rg-cont -n aks-shop --node-count 3 --zones 1 2 3 --enable-managed-identity \
--network-plugin azure --enable-cluster-autoscaler --min-count 3 --max-count 8 --attach-acr acrshop482 --enable-oidc-issuer --enable-workload-identity
az aks get-credentials -g rg-cont -n aks-shop
kubectl get nodes
kubectl create deployment web --image=acrshop482.azurecr.io/shop:v1 --replicas=3
kubectl expose deployment web --port=80 --target-port=8080 --type=LoadBalancer
| AKS feature | Meaning |
|---|---|
| Networking | Azure CNI (pods get VNet IPs, or overlay mode) or kubenet |
| Autoscaling | Horizontal Pod Autoscaler, cluster autoscaler, KEDA |
| Ingress | Application Gateway for Containers, NGINX/ingress controllers |
| Identity | Workload identity for pods to access Azure services without secrets |
| Security | Private cluster, Azure Policy for Kubernetes, Defender for Containers, network policies |
| Upgrades | Auto-upgrade channels and planned maintenance windows |
| Observability | Container insights, managed Prometheus and Grafana |
Decision Guide
| Need | Choose |
|---|---|
| Run one container or a job quickly | ACI |
| Microservices with scale to zero, small team | Container Apps |
| Web app from a container with App Service features | App Service for Containers |
| Full Kubernetes API, custom controllers, large complex platforms | AKS |
| Store and secure images | ACR |
| Traditional VM workload | Virtual Machines |
Practice
- Build an image with
az acr build - Deploy it to Container Apps with scale to zero
- Create an AKS cluster, attach ACR and deploy the app
- Scale the deployment and watch the cluster autoscaler add a node
- Delete the cluster to stop cost
Conclusion
ACR stores images. ACI runs single containers quickly, Container Apps gives serverless microservices, and AKS gives full Kubernetes. Choose by team skill and need, and use managed identity instead of passwords.
Quick Summary: containers; ACR; ACI; Container Apps; AKS; decision.

