azure - 尝试将 docker 推送到 Azure 容器注册表时出现 "unauthorized: authentication required"

标签 azure docker azure-iot-hub azure-iot-edge

我正在关注this tutorial展示如何使用 Linux 容器开发 IoT Edge 模块。

我已经创建了一个 Azure 注册表(我将其称为 myazureregistry)。

现在我尝试将示例模块“docker Push”到此注册表:

sudo docker push myazureregistry.azurecr.io/filtermodule:0.0.1-amd64

唉,当运行这个命令时,我遇到了以下错误:

unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.

我已经检查过网页。它指出:

The ability to docker push an image [...] requires authentication with the registry using the authorized identity.

但我已经使用sudo az acr login --name myazureregistry 成功登录

我在这里缺少什么?


编辑[09/04/2023]:

我检查了列出的权限 here 。我的贡献者角色应该允许我推送图像。

enter image description here

最佳答案

当您尝试执行命令az acr login --name myazureregistry时,它是否提示输入任何密码?如果 az acr login 命令 不提示输入任何凭据,则意味着您已使用 Azure CLI 通过 Azure 身份验证。在这种情况下,该命令使用现有身份验证上下文让您登录到指定的 Azure 容器注册表 (ACR) 实例。登录的用户可能没有将镜像推送到 Azure 容器注册表所需的权限。

要解决此问题,请在登录容器注册表之前执行以下命令。

docker login -u <ACR username> -p <ACR password> <ACR login server>

您可以通过导航到 Azure 容器注册表和访问 key 部分从 Azure 门户获取凭据。请引用下图。

enter image description here

Make sure that the Admin user option is enabled for the user.

关于azure - 尝试将 docker 推送到 Azure 容器注册表时出现 "unauthorized: authentication required",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75954102/

相关文章:

azure - 通过 API 触发 Azure Pipelines 构建

Azure Functions - 找不到文件

amazon-web-services - Docker nfs4 安装在 Elastic Beanstalk 上

java - 使用 Java 访问 IoT 中心 Azure 中的数据

azure - 如何从移动应用程序配置 Azure IoT 设备

c# - Azure Key Vault 中的应用程序设置配置部分

具有承载授权的 Azure Multi-Tenancy ASP.Net-Core 应用程序

arrays - 如何将字符串拆分为数组并循环遍历它?

docker - 生产就绪的 Kubernetes redis

mqtt - 我可以向通过 MQTT WebSocket 连接的一组 Azure IoT 中心设备发送消息吗?