What is ACI?
ACI runs containers directly on Azure infrastructure — no cluster, no node management, no orchestration setup. You specify an image, CPU, memory, and ACI handles everything else. Containers are billed per-second for actual CPU and memory used.
| Feature | Detail |
|---|---|
| Startup time | Seconds |
| OS support | Linux and Windows containers |
| Max CPU per group | 4 vCPU |
| Max memory per group | 16 GB |
| Billing | Per second of CPU + memory |
| Persistence | None by default — use Azure Files for persistent storage |
Container Groups
A container group is a collection of containers that run on the same host, share the same lifecycle, network, and storage. This is ACI equivalent of a Kubernetes pod.
- Containers in a group share the same IP address and port namespace
- They can communicate via localhost
- All containers in a group start and stop together
- Common pattern: app container + sidecar (logging, proxy, metrics)
Restart Policies
| Policy | Behaviour | Use For |
|---|---|---|
| Always | Always restart — even on success | Long-running services, web apps |
| Never | Never restart — run once and stop | One-time jobs, batch tasks |
| OnFailure | Restart only if container exits with non-zero code | Jobs that should retry on failure but stop on success |
Networking
- Public IP — ACI can expose a public IP address with a DNS name label
- DNS name — Custom DNS label:
mycontainer.centralindia.azurecontainer.io - VNet integration — Deploy ACI into a VNet subnet for private access
- Port exposure — Specify which ports to expose publicly
Persistent Storage
ACI containers are ephemeral by default — storage is lost when the container stops. For persistent data, mount an Azure Files share:
az container create \
--resource-group myRG \
--name mycontainer \
--image myregistry.azurecr.io/myapp:v1 \
--azure-file-volume-account-name mystorageaccount \
--azure-file-volume-account-key $STORAGE_KEY \
--azure-file-volume-share-name myshare \
--azure-file-volume-mount-path /data
Creating ACI via CLI
# Create a simple public container
az container create \
--resource-group myRG \
--name mywebcontainer \
--image nginx:latest \
--dns-name-label mywebapp-2026 \
--ports 80 \
--cpu 1 \
--memory 1.5
# Create from private ACR
az container create \
--resource-group myRG \
--name myappcontainer \
--image myregistry.azurecr.io/myapp:v1 \
--registry-login-server myregistry.azurecr.io \
--registry-username $SP_APP_ID \
--registry-password $SP_PASSWORD \
--dns-name-label myapp-2026 \
--ports 3000 \
--restart-policy OnFailure \
--environment-variables NODE_ENV=production
# View container logs
az container logs --resource-group myRG --name myappcontainer
# View container status
az container show \
--resource-group myRG \
--name myappcontainer \
--query instanceView.state
# Delete container
az container delete --resource-group myRG --name myappcontainer --yes
When to Use ACI
| Good fit for ACI | Not a good fit — use AKS or Container Apps |
|---|---|
| Batch jobs and one-time tasks | High-traffic production services needing auto-scale |
| CI/CD pipeline steps | Microservices needing service discovery |
| Dev/test containers | Stateful workloads needing complex storage |
| Event-driven short tasks | Applications requiring rolling deployments |
| Simple web apps with predictable load | Multi-container apps with complex dependencies |