Question

Difficulty: EasyManage Container Images in Azure Container Registry

You have a private Azure Container Registry named registry2026. You need to copy a public container image named redis:alpine from Docker Hub directly into your registry without pulling it to your local development machine first. Which of the following Azure CLI commands should you run?

  1. A
    az acr login --name registry2026 --identity
  2. B
    docker push registry2026.azurecr.io/redis:alpine
  3. az acr import --name registry2026 --source docker.io/library/redis:alpine --image redis:alpineAnswer
  4. D
    az acr repository push --name registry2026 --image redis:alpine

Answer

Use the az acr import command specifying the registry name, the source image from Docker Hub, and the target image name.
The command starting with 'az acr import' is correct because it uses the Azure Container Registry import capability to copy an image directly from Docker Hub (docker.io) into the specified registry. This bypasses the need to install Docker locally, pull the image, authenticate, tag the image, and push it.

Step-by-Step Solution

1
Identify the target container registry and the source image registry path.
Target registry is registry2026 and source image path is docker.io/library/redis:alpine.
Knowing the correct source and destination identifiers is necessary to construct the command.
2
Select the Azure CLI command designed for direct network-to-network registry image copying.
The az acr import command is identified.
This command avoids pulling the image locally to a developer workstation and then pushing it back up to Azure.
3
Construct and execute the command with the correct parameters.
az acr import --name registry2026 --source docker.io/library/redis:alpine --image redis:alpine is executed.
This copies the image directly within the Azure backbone from Docker Hub to the specified Container Registry.

Key Concept

Directly importing container images from public or external registries into an Azure Container Registry using the Azure CLI.
Rate this question