尝试从 ACR 拉取图像时 Azure Release Pipeline 失败

Azure Release Pipeline fails when try to pull image from ACR

我尝试将 Azure 管道用于 ci 和 cd。

1- 我的应用程序映像已构建并推送到 Azure 容器注册表。

2- 发布管道尝试从 ACR 中提取图像时出现错误。 来自容器设置的日志:

INFO  - Pulling image: registryname/repo:latest
ERROR - DockerApiException: Docker API responded with status code=InternalServerError, response={"message":"Get https://registry-1.docker.io/v2/registryname/repo/manifests/latest: unauthorized: incorrect username or password"}

ERROR - Pulling docker image registryname/repo:latest failed:
INFO  - Pulling image from Docker hub: registryname/repo:latest
ERROR - DockerApiException: Docker API responded with status code=NotFound, response={"message":"pull access denied for registryname/repo, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"}

ERROR - Image pull failed: Verify docker image configuration and credentials (if using private repository)
INFO  - Stopping site appname because it failed during startup.

来自配置的 Ss:

感谢您的帮助。

当你使用ACR存储镜像,并希望将其中的镜像部署到Azure Web App时,需要将镜像名称设置为ACRName.azurecr.io/image:tag,而不是只是图像名称和标签。并设置环境变量,如:

DOCKER_REGISTRY_SERVER_USERNAME - The username for the ACR server. DOCKER_REGISTRY_SERVER_URL - The full URL to the ACR server. (For example, https://my-server.azurecr.io.) DOCKER_REGISTRY_SERVER_PASSWORD - The password for the ACR server.

并且凭据应该有足够的权限。一切正常后,容器日志将如下所示: