Bird
Raised Fist0
Azurecloud~10 mins

Azure Container Registry (ACR) - Step-by-Step Execution

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Process Flow - Azure Container Registry (ACR)
Create ACR Instance
Push Container Image
Store Image in Registry
Pull Image from Registry
Deploy Container from Image
Update or Delete Images
End
This flow shows how you create an Azure Container Registry, push container images to it, store them, pull them for deployment, and manage images.
Execution Sample
Azure
az acr create --resource-group mygroup --name myregistry --sku Basic
az acr login --name myregistry
az acr repository list --name myregistry
az acr repository show-tags --name myregistry --repository myapp
This code creates an ACR, logs in to it, lists repositories, and shows tags for a repository.
Process Table
StepCommandActionResult
1az acr create --resource-group mygroup --name myregistry --sku BasicCreate ACR instanceACR 'myregistry' created in resource group 'mygroup' with Basic SKU
2az acr login --name myregistryAuthenticate Docker client to ACRDocker client logged in to 'myregistry'
3az acr repository list --name myregistryList repositories in ACRReturns empty list [] (no images pushed yet)
4docker build -t myregistry.azurecr.io/myapp:v1 .Build container image tagged for ACRImage 'myapp:v1' built locally
5docker push myregistry.azurecr.io/myapp:v1Push image to ACRImage 'myapp:v1' pushed to 'myregistry'
6az acr repository list --name myregistryList repositories againReturns ['myapp'] showing pushed image repository
7az acr repository show-tags --name myregistry --repository myappShow tags for 'myapp'Returns ['v1'] showing pushed image tag
8docker pull myregistry.azurecr.io/myapp:v1Pull image from ACRImage 'myapp:v1' pulled successfully
9az acr repository delete --name myregistry --image myapp:v1 --yesDelete image tagImage tag 'v1' deleted from 'myapp' repository
10az acr repository list --name myregistryList repositories after deletionReturns [] (repository empty after tag deletion)
💡 All steps complete showing full lifecycle of image creation, push, pull, and deletion in ACR
Status Tracker
VariableStartAfter Step 1After Step 5After Step 7After Step 9Final
ACR InstanceNonemyregistry createdmyregistry existsmyregistry existsmyregistry existsmyregistry exists
Repositories[][]['myapp']['myapp'][][]
Image Tags in 'myapp'[][]['v1']['v1'][][]
Key Moments - 3 Insights
Why does the repository list show empty before pushing any images?
Before pushing, no images exist in the registry, so the repository list is empty as shown in step 3 of the execution_table.
What happens if you try to pull an image before pushing it?
Pulling before pushing will fail because the image does not exist in the registry yet. This is implied by the empty repository list before step 5.
Why does deleting the only tag remove the repository from the list?
In ACR, a repository exists only if it has tags. Deleting the last tag removes the repository, as shown between steps 9 and 10.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the repository list after pushing the image?
A[]
B['v1']
C['myapp']
D['myregistry']
💡 Hint
Check step 6 in the execution_table where repositories are listed after pushing.
At which step does the image get successfully pulled from the registry?
AStep 8
BStep 5
CStep 4
DStep 10
💡 Hint
Look for the 'docker pull' command in the execution_table.
If you delete the only tag of a repository, what happens to the repository list?
ARepository is renamed
BRepository is removed from the list
CRepository remains listed
DRepository tags become empty but repository stays
💡 Hint
Refer to steps 9 and 10 in the execution_table showing repository list changes after deletion.
Concept Snapshot
Azure Container Registry (ACR) stores container images securely.
Create ACR with 'az acr create'.
Push images using Docker tagged with ACR login.
List repositories and tags with 'az acr repository list' and 'show-tags'.
Pull images for deployment.
Deleting all tags removes the repository.
Full Transcript
Azure Container Registry (ACR) is a service to store container images. First, you create an ACR instance in your Azure resource group. Then you log in to it using Azure CLI. Initially, the registry has no images, so listing repositories returns empty. You build a container image locally and tag it with your registry's login server name. Next, you push the image to ACR. After pushing, the repository appears in the list with its tags. You can pull the image from ACR to deploy containers. If you delete all tags of a repository, the repository disappears from the list. This flow shows the lifecycle of container images in ACR from creation to deletion.

Practice

(1/5)
1. What is the main purpose of Azure Container Registry (ACR)?
easy
A. To securely store and manage container images in Azure
B. To create virtual machines in Azure
C. To monitor network traffic in Azure
D. To manage Azure user permissions

Solution

  1. Step 1: Understand what ACR is designed for

    Azure Container Registry is a service to store container images securely in Azure.
  2. Step 2: Compare options with ACR's purpose

    Only To securely store and manage container images in Azure describes storing and managing container images, which matches ACR's main use.
  3. Final Answer:

    To securely store and manage container images in Azure -> Option A
  4. Quick Check:

    ACR purpose = store container images [OK]
Hint: ACR is for container images, not VMs or users [OK]
Common Mistakes:
  • Confusing ACR with Azure VM services
  • Thinking ACR manages user permissions
  • Assuming ACR monitors network traffic
2. Which of the following is the correct Azure CLI command to create an Azure Container Registry named myRegistry in resource group myGroup with the Basic SKU?
easy
A. az acr new --group myGroup --registry myRegistry --tier Basic
B. az acr create --resource-group myGroup --registry-name myRegistry --sku Basic
C. az container registry create --group myGroup --name myRegistry --sku Basic
D. az acr create --resource-group myGroup --name myRegistry --sku Basic

Solution

  1. Step 1: Recall the correct Azure CLI syntax for ACR creation

    The correct command uses az acr create with parameters --resource-group, --name, and --sku.
  2. Step 2: Match options to correct syntax

    az acr create --resource-group myGroup --name myRegistry --sku Basic matches the exact syntax. Options A, C, and D use incorrect commands or parameter names.
  3. Final Answer:

    az acr create --resource-group myGroup --name myRegistry --sku Basic -> Option D
  4. Quick Check:

    Correct CLI syntax = az acr create --resource-group myGroup --name myRegistry --sku Basic [OK]
Hint: Use 'az acr create' with --resource-group and --name [OK]
Common Mistakes:
  • Using wrong command like 'az acr new'
  • Incorrect parameter names like --registry-name
  • Confusing 'az container registry' with 'az acr'
3. Given this Azure CLI command sequence, what will be the output of the last command?
az acr create --resource-group myGroup --name myRegistry --sku Standard
az acr login --name myRegistry
az acr repository list --name myRegistry --output json
medium
A. A JSON list of repositories stored in myRegistry, initially empty
B. An error saying the registry does not exist
C. A list of running containers in myRegistry
D. A JSON list of all Azure resource groups

Solution

  1. Step 1: Understand the commands run

    The first command creates the registry. The second logs into it. The third lists repositories in JSON format.
  2. Step 2: Predict output of repository list on new registry

    Since the registry is new, it has no repositories yet, so the output is an empty JSON list.
  3. Final Answer:

    A JSON list of repositories stored in myRegistry, initially empty -> Option A
  4. Quick Check:

    New registry repo list = empty JSON list [OK]
Hint: New ACR has empty repo list JSON output [OK]
Common Mistakes:
  • Expecting error when registry exists
  • Confusing repositories with running containers
  • Thinking it lists resource groups
4. You run this command but get an error:
az acr create --resource-group myGroup --name myRegistry --sku Basic --location eastus

What is the most likely cause of the error?
medium
A. The command syntax is incorrect
B. The SKU Basic is not supported in eastus
C. The resource group myGroup does not exist
D. The registry name myRegistry is already in use globally

Solution

  1. Step 1: Check command syntax and parameters

    The syntax is correct and Basic SKU is supported in eastus.
  2. Step 2: Identify common causes of creation errors

    If the resource group does not exist, creation fails with an error.
  3. Final Answer:

    The resource group myGroup does not exist -> Option C
  4. Quick Check:

    Missing resource group causes create error [OK]
Hint: Ensure resource group exists before creating ACR [OK]
Common Mistakes:
  • Assuming SKU is unsupported without checking
  • Ignoring resource group existence
  • Thinking registry name conflict causes this error
5. You want to speed up your app deployment by sharing container images across multiple Azure regions. Which ACR feature should you enable to replicate your registry automatically to other regions?
hard
A. Configure Azure Traffic Manager for your registry
B. Enable geo-replication on your Azure Container Registry
C. Use Azure Blob Storage replication instead
D. Create multiple separate registries manually in each region

Solution

  1. Step 1: Understand the need for multi-region image availability

    To share images across regions and speed deployment, the registry must replicate images automatically.
  2. Step 2: Identify ACR feature for automatic replication

    Geo-replication is the ACR feature that replicates container images across regions automatically.
  3. Step 3: Evaluate other options

    Creating registries manually is manual and error-prone. Blob Storage replication is unrelated to container images. Traffic Manager manages traffic, not image replication.
  4. Final Answer:

    Enable geo-replication on your Azure Container Registry -> Option B
  5. Quick Check:

    Multi-region image sharing = geo-replication [OK]
Hint: Use geo-replication to sync images across regions [OK]
Common Mistakes:
  • Manually creating registries instead of replicating
  • Confusing storage replication with ACR replication
  • Using Traffic Manager for image replication