Containers: ACR, Container Instances and Container Apps

AZ-104 Azure AdministratorComputeAbout 20 minutesBy Cloud Hands On

Store images in Azure Container Registry, run them quickly in Container Instances, and scale microservices with Container Apps.

In this lesson you'll learn

1. The container flow

New to containers? Start here

A container image packages an app with everything it needs to run: code, runtime and libraries. It runs the same on a laptop, a test server or Azure. A registry stores images, like an app store for your own software.

Build an image, push it to Azure Container Registry, then run it on Container Instances, Container Apps or AKS Builddocker build Container Registrydocker push Container Instances Container Apps Kubernetes Service (AKS)
The image must be in the registry before any service can pull and run it.

2. Azure Container Registry

SKUAdds
BasicEntry level storage and throughput
StandardMore storage and throughput
PremiumGeo-replication, private endpoints, content trust
az acr build --registry crsskaiser --image shop:v2 .
az aks update -n aks-shop -g rg-apps --attach-acr crsskaiser
  • ACR Tasks (az acr build) builds images in Azure, with no Docker on your machine.
  • Grant AcrPull to services that only pull images, and AcrPush to build pipelines.

3. Azure Container Instances

The fastest way to run a container: no servers and no orchestrator, billed per second.

  • A container group is a set of containers sharing a host, network and storage. Multi-container groups are Linux only.
  • Restart policies: Always (default), OnFailure and Never.
  • For data that must survive restarts, mount an Azure file share as a volume.
  • Set the IP address type to Public for internet access, optionally with a DNS name label.

4. Azure Container Apps

Serverless containers for web APIs, microservices and background workers, with Kubernetes power but none of the cluster management.

  • Scaling rules: HTTP traffic, TCP connections, CPU and memory, or event-driven rules powered by KEDA, such as messages waiting in Service Bus. Apps can scale to zero.
  • Revisions are immutable versions of an app. In multiple revision mode you can split traffic, for example 80% to v1 and 20% to v2.
NeedService
Run one container quickly, a batch job or a simple taskContainer Instances
Microservices that scale on events and trafficContainer Apps
Full Kubernetes control and custom networkingAKS

Example

SS Kaiser's order processor reads messages from a Service Bus queue. Overnight the queue is empty, so the Container App scales to zero and costs nothing. When the morning rush arrives, its KEDA rule sees 5,000 waiting messages and scales to 20 replicas within a minute.

Exam traps to remember

  • Push to the registry before deploying the image anywhere.
  • Geo-replication needs ACR Premium.
  • Windows containers in ACI support single-container groups only.
  • Scaling on queue messages means an event-driven (KEDA) rule.

Test yourself: 3 check questions and exam-style practice questions on this topic are in the AZ-104 Azure Administrator app.

Practise in the app

Keep going