4. Push the image to Azure Container Registry
Azure Container Registry (ACR) is a private registry that integrates with Azure identity and networking.
Create the registry
az acr create \
--resource-group $RG \
--name $ACR_NAME \
--sku Basic
Basic is fine for learning. Use Standard or Premium for production features such as higher throughput, geo-replication and private endpoints.
Option A: build in the cloud (no local Docker needed)
az acr build \
--registry $ACR_NAME \
--image $IMAGE:$TAG \
.
Option B: build locally and push
az acr login --name $ACR_NAME
docker build -t $ACR_NAME.azurecr.io/$IMAGE:$TAG .
docker push $ACR_NAME.azurecr.io/$IMAGE:$TAG
Verify
az acr repository list --name $ACR_NAME --output table
az acr repository show-tags --name $ACR_NAME --repository $IMAGE --output table
Tagging advice
- Use immutable tags such as a version number or Git commit SHA (
v1.4.2,a1b2c3d). - Avoid relying on
latestin production: it makes rollbacks and audits difficult.
Avoid the ACR admin account. It uses shared credentials. In the next steps, you will use a
managed identity with the
AcrPull role so no passwords are stored anywhere.