Docker Push Container to Azure ACR "unauthorized: authentication required"



这是怎么回事?这应该可以工作。

$ az logout
$ az login
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code FW....C to authenticate.
[
{
"cloudName": "AzureCloud",
"homeTenantId": "[redacted]",
"id": "[redacted]",
"isDefault": true,
"managedByTenants": [],
"name": "Azure subscription 1",
"state": "Enabled",
"tenantId": "[redacted]",
"user": {
"name": "[redacted]",
"type": "user"
}
}
]
$ az account set -s [subscription id redacted]
$ az acr login --name arcticacr
Login Succeeded
$ docker push ArcticaCR.azurecr.io/sftp01/sftptest:0.02
The push refers to a repository [ArcticaCR.azurecr.io/sftp01/sftptest]
b152ea134f5f: Preparing 
d799cb5f12bf: Preparing 
6b4e8c931236: Preparing 
6f4c91ca60bd: Preparing 
86eecfa8066e: Preparing 
unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.

我作为这个注册表的所有者登录(每个IAM)。我应该被授权做任何事。Admin用户在Access键下启用,即使我不使用这些。

spottedmahn在这个帖子上给出了答案(尽管它远远不是最热门的答案,而其他答案更适合使用Azure Devops UI): Push Docker Image task to ACR在Azure中失败"unauthorized: authentication required">

图片名称必须全部小写。你不能把push命令改成小写。

$ docker build -t arcticacr.azurecr.io/sftp01/sftptest:0.02 -f Dockerfile .
$ az login
$ az account set -s [subscription id redacted]
$ az acr login --name arcticacr
$ docker push arcticacr.azurecr.io/sftp01/sftptest:0.02