gpt4 book ai didi

linux - 通过 Azure Devops 将 docker 镜像部署到 Linux 上的 Web 应用程序失败

转载 作者:行者123 更新时间:2023-12-02 14:34:24 28 4
gpt4 key购买 nike

我正在尝试通过 Azure Devops 中的发布管道将我的 docker 镜像部署到容器 Web 应用程序 (Linux)。我正在使用任务Azure Web App for Containers来完成此任务。

在 Azure 中构建镜像并将其推送到我的私有(private)容器注册表工作正常。但是,当我尝试部署新构建和推送的镜像时,我收到身份验证错误

Azure Devops 报告部署进展顺利,但当我在 Azure 中的容器设置选项卡中查看 Docker 日志时,我看到身份验证错误。如果我尝试直接在容器设置中部署我的镜像,它会按预期工作。

之前,我已将服务连接到我的 Azure 订阅,并且还为我的 Azure 容器注册表添加了单独的服务连接。我没有使用 docker compose,而是尝试部署单个镜像/容器。

Azure DevOps 日志:

2019-08-12T13:48:47.3512681Z ##[section]Starting: Azure Web App on Container Deploy: my-service
2019-08-12T13:48:47.3676562Z ==============================================================================
2019-08-12T13:48:47.3676709Z Task : Azure Web App for Containers
2019-08-12T13:48:47.3676775Z Description : Deploy containers to Azure App Service
2019-08-12T13:48:47.3676828Z Version : 1.0.22
2019-08-12T13:48:47.3676870Z Author : Microsoft Corporation
2019-08-12T13:48:47.3676932Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-containers
2019-08-12T13:48:47.3677003Z ==============================================================================
2019-08-12T13:48:47.6472308Z Got service connection details for Azure App Service:'my-service'
2019-08-12T13:48:48.7565776Z Single-container Deployment to the webapp 'my-service' as only the image detail was sepcified.
2019-08-12T13:48:49.2180101Z Updating App Service Configuration settings. Data: {"appCommandLine":null,"linuxFxVersion":"DOCKER|my-registry.azurecr.io/my-repository:latest"}
2019-08-12T13:48:51.1744261Z Updated App Service Configuration settings.
2019-08-12T13:48:51.1752210Z Restarting App Service: my-service
2019-08-12T13:48:51.6881923Z App Service 'my-service' restarted successfully.
2019-08-12T13:48:54.9987139Z Successfully updated deployment History at https://my-service.scm.azurewebsites.net/api/deployments/12431565617733135
2019-08-12T13:48:55.5252693Z App Service Application URL: https://my-service.azurewebsites.net
2019-08-12T13:48:55.5391444Z ##[section]Finishing: Azure Web App on Container Deploy: my-service

enter image description here

Azure 中的 Docker 日志:

2019-08-12 07:54:11.184 INFO  - Pulling image: my-registry.azurecr.io/my-service:20190812.8
2019-08-12 07:54:11.424 ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"manifest for my-registry.azurecr.io/my-service:20190812.8 not found: manifest unknown: manifest unknown"}

2019-08-12 07:54:11.425 ERROR - Pulling docker image my-registry.azurecr.io/my-service:20190812.8 failed:
2019-08-12 07:54:11.426 INFO - Pulling image from Docker hub: my-registry.azurecr.io/my-service:20190812.8
2019-08-12 07:54:11.461 ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://my-registry.azurecr.io/v2/my-service:/manifests/20190812.8: unauthorized: authentication required"}

2019-08-12 07:54:11.463 ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)
2019-08-12 07:54:13.482 INFO - Pulling image: my-registry.azurecr.io/my-service:20190812.8
2019-08-12 07:54:13.588 ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"manifest for my-registry.azurecr.io/my-service:20190812.8 not found: manifest unknown: manifest unknown"}

2019-08-12 07:54:13.593 ERROR - Pulling docker image my-registry.azurecr.io/my-service:20190812.8 failed:
2019-08-12 07:54:13.593 INFO - Pulling image from Docker hub: my-registry.azurecr.io/my-service:20190812.8
2019-08-12 07:54:13.628 ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://my-registry.azurecr.io/v2/my-service:/manifests/20190812.8: unauthorized: authentication required"}

2019-08-12 07:54:13.629 ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)
2019-08-12 07:54:17.116 INFO - Pulling image: my-registry.azurecr.io/my-service:20190812.8
2019-08-12 07:54:17.244 ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"manifest for my-registry.azurecr.io/my-service:20190812.8 not found: manifest unknown: manifest unknown"}

2019-08-12 07:54:17.245 ERROR - Pulling docker image my-registry.azurecr.io/my-service:20190812.8 failed:
2019-08-12 07:54:17.246 INFO - Pulling image from Docker hub: my-registry.azurecr.io/my-service:20190812.8
2019-08-12 07:54:17.281 ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://my-registry.azurecr.io/v2/my-service:/manifests/20190812.8: unauthorized: authentication required"}

2019-08-12 07:54:17.283 ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)

有人遇到过同样的问题吗?即使我在 Azure Devops 中添加了服务连接,我是否明确需要向注册表提供凭据?

最佳答案

作为最后的手段,我通过删除与 Azure Devops 中的订阅的服务连接并将其添加回来,使其神奇地发挥作用。 (无需为 Azure 容器注册表建立单独的服务连接)

非常令人沮丧!

关于linux - 通过 Azure Devops 将 docker 镜像部署到 Linux 上的 Web 应用程序失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57466867/

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