A developer needs to push a locally built container image to an Azure Container Registry (ACR) named contosoacr. The developer has already logged into their Azure account on their workstation using the Azure CLI command az login. However, when they attempt to push the image, they receive an authentication error from the Docker daemon.
Which of the following Azure CLI commands should the developer run to authenticate the local Docker daemon to the registry?
- az acr login --name contosoacrAnswer
- Bdocker login contosoacr.azurecr.io
- Caz login --registry contosoacr
- Daz acr login --name contosoacr --identity
Answer
Run the command az acr login --name contosoacr to authenticate the local Docker daemon to the registry.
The command az acr login --name contosoacr uses the active Azure CLI session to fetch a token and configure the local Docker daemon. This allows the subsequent docker push command to authenticate successfully against the private container registry.
Step-by-Step Solution
Key Concept
Authenticating a local developer workstation to Azure Container Registry using the Azure CLI.