gpt4 book ai didi

Azure Web App 的 Azure 容器注册表授权

转载 作者:行者123 更新时间:2023-12-02 23:40:34 26 4
gpt4 key购买 nike

有没有办法从 Azure 容器注册表中提取镜像,而无需使用以下应用设置?

DOCKER_REGISTRY_SERVER_URLDOCKER_REGISTRY_SERVER_PASSWORD

我尝试为我的应用服务提供适当的 RBAC 并在容器部署 DevOps 任务上使用 Azure Web 应用,但这不起作用。

目前,我使用管理员用户/密码将其设置为 CD,但这不是我想要投入生产的选项。

我收到的错误消息(当我未设置 DOCKER_REGISTRY_SERVER_URL 和 DOCKER_REGISTRY_SERVER_PASSWORD 时):

2020-06-18T11:01:51.313Z INFO - Pulling image from Docker hub: xx.azurecr.io/xx:xx

2020-06-18T11:01:51.545Z ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://xx.azurecr.io/v2/xx/manifests/xx: unauthorized: authentication required"}

2020-06-18T11:01:51.553Z ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)

最佳答案

应用程序设置中的环境变量:

DOCKER_REGISTRY_SERVER_URL DOCKER_REGISTRY_SERVER_PASSWORD

是当您需要从 Azure 容器注册表中提取镜像时必需的内容。您需要了解应用程序设置中的 ACR 凭据与 Web 应用程序的托管身份之间的正确顺序。

Web 应用程序的托管身份用于在运行时访问 Web 应用程序内的其他资源。请注意,Web 应用程序正在运行。这意味着图像已经从 ACR 中提取。所以您会看到,ACR 的凭据将在托管身份之前使用。如果不设置凭证,则无法拉取镜像,导致Web App无法正常运行。此时,托管身份就没有意义了。

关于Azure Web App 的 Azure 容器注册表授权,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62448584/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com