-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
Azure Container Registry (ACR) supports anonymous pull access, but az create container always requires credentials when azurecr.io is detected in the image URL.
This makes it unnecessarily difficult to create a container group using a container image hosted in ACR with anonymous pull access enabled.
Related command
Here's my ACR with anonymous pull access enabled...
$ az acr show -n myacrwithanonymouspullaccess | grep anonymous
"anonymousPullEnabled": true,
... so, no credentials are required to pull an image from it. Look, I can do it from my local machine without logging in...
$ docker pull myacrwithanonymouspullaccess.azurecr.io/myimage:latest
latest: Pulling from myimage
Digest: sha256:d063655c..81
Status: Image is up to date for myacrwithanonymouspullaccess.azurecr.io/myimage:latest
... so I should be able to create a container group without providing any credentials. But az container create detects azurecr.io in the image URL (right here) and prompts for registry username and password:
$ az container create -g myrg --name aci-test --image myacrwithanonymouspullaccess.azurecr.io/myimage:latest
--cpu 1 --memory 1
Image registry username:
Looks like as a workaround, it's possible to just provide random invalid credentials:
$ az container create -g myrg --name aci-test --image myacrwithanonymouspullaccess.azurecr.io/myimage:latest
--cpu 1 --memory 1 --registry-password "foo" --registry-username "foo"
Errors
n/a there's no error message, the error is that the command shouldn't prompt for credentials
Issue script & Debug output
n/a
Expected behavior
The error is that az container create prompts for credentials in the above scenario when it shouldn't, because the image might be hosted in ACR with anonymous pull access enabled.
Environment Summary
{
"azure-cli": "2.67.0",
"azure-cli-core": "2.67.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {
"account": "0.2.5",
"containerapp": "1.1.0b1",
"devcenter": "6.1.0"
}
}
Additional context
No response