You are configuring a CI/CD pipeline script to push container images to an Azure Container Registry (ACR) named `myregistry`. The script runs in a lightweight container context where only the Docker CLI is available for the build and push steps. To authenticate, you have already retrieved a Microsoft Entra ID access token for the registry using the Azure CLI and stored it in a variable named `$TOKEN`.
You need to run the `docker login` command to authenticate the local Docker daemon to the registry using this token.
Which command should you run?
- docker login myregistry.azurecr.io --username 00000000-0000-0000-0000-000000000000 --password $TOKENAnswer
- Bdocker login myregistry.azurecr.io --username myregistry --password $TOKEN
- Cdocker login myregistry.azurecr.io --username <Managed-Identity-Client-ID> --password $TOKEN
- Daz acr login --name myregistry --username 00000000-0000-0000-0000-000000000000 --password $TOKEN
Answer
docker login myregistry.azurecr.io --username 00000000-0000-0000-0000-000000000000 --password $TOKEN
The correct command uses the docker login utility to target the myregistry.azurecr.io login server. When authenticating with an access token (such as a Microsoft Entra ID token), the registry requires the username parameter to be the specific GUID 00000000-0000-0000-0000-000000000000, and the password parameter to contain the token value.
Step-by-Step Solution
Key Concept
Authenticating with Azure Container Registry using tokens