Azure 容器注册表 az acr 构建命令超时并出现 404 BlobNotFound

问题描述 投票:0回答:1

我在执行 az acr 构建时遇到问题,该构建过去可以正常工作几个月。

我运行命令为:

az acr build -t [TAG] --registry [CONTAINER REGISTRY NAME] --agent-pool [AGENT POOL NAME] [SOURCE]

它返回错误:

HTTP status code=404, Exception=The specified blob does not exist. ErrorCode: BlobNotFound

多次,然后超时。

我添加了 --debug 参数,它显示正在进行的多个 REST 调用,前几个似乎做了一些一般性的事情,例如获取有关存储库、访问等的信息,并且显然工作正常。

然后是以下 POST 调用(我相信它的目标是安排构建):

DEBUG: msrest.http_logger: Request URL: 'https://management.azure.com/subscriptions/****/resourceGroups/****/providers/Microsoft.ContainerRegistry/registries/****/scheduleRun?api-version=2019-06-01-preview'
DEBUG: msrest.http_logger: Request method: 'POST'
DEBUG: msrest.http_logger: Request headers:
DEBUG: msrest.http_logger:     'Accept': 'application/json'
DEBUG: msrest.http_logger:     'Content-Type': 'application/json; charset=utf-8'
DEBUG: msrest.http_logger:     'accept-language': 'en-US'
DEBUG: msrest.http_logger:     'Content-Length': '480'
DEBUG: msrest.http_logger:     'User-Agent': 'python/3.6.10 (Linux-5.15.0-1056-azure-x86_64-with-debian-10.5) msrest/0.6.18 msrest_azure/0.6.3 azure-mgmt-containerregistry/3.0.0rc16 Azure-SDK-For-Python AZURECLI/2.18.0 (DEB)'
DEBUG: msrest.http_logger: Request body:
DEBUG: msrest.http_logger: {"isArchiveEnabled": false, "agentPoolName": "[AGENT POOL NAME]", "type": "DockerBuildRequest", "imageNames": ["IMAGE NAME"], "isPushEnabled": true, "noCache": false, "dockerFilePath": "[DOCKER FILE PATH]", "arguments": [], "platform": {"os": "linux", "architecture": "amd64"}, "sourceLocation": "source/202403140000/3ed4a45c-78f2-4454-be9d-4809af863fd3.tar.gz", "credentials": {}}

返回 200 并且似乎触发了代理,稍后日志显示:

WARNING: cli.azure.cli.command_modules.acr.build: Queued a build with ID: cg2h4
WARNING: cli.azure.cli.command_modules.acr.build: Waiting for an agent...

接下来是另一个电话:

DEBUG: msrest.http_logger: Request URL: 'https://management.azure.com/subscriptions/****/resourceGroups/****/providers/Microsoft.ContainerRegistry/registries/****/runs/cg2h4/listLogSasUrl?api-version=2019-06-01-preview'
DEBUG: msrest.http_logger: Request method: 'POST'

显然是为了获取日志链接,之后日志里全是:

Receiving Response: Server-Timestamp=Thu, 14 Mar 2024 15:39:07 GMT, Server-Request-ID=19016337-e01e-001d-5725-76d214000000, HTTP Status Code=404, Message=The specified blob does not exist.

直到超时。

有什么想法可能导致这种情况,或者至少可以采取什么措施进行调查?

azure azure-cli azure-container-registry
1个回答
0
投票

HTTP 状态代码=404,异常=指定的 blob 不存在:

需要检查以下内容:

当您尝试使用的 blob 不存在或未正确给出路径时,会发生上述错误。检查源位置参数是否正确传递。

还要确保代理池有权访问源位置。 (存储配置访问)

检查正在使用的代理池没有网络限制,并且代理池完全处于活动状态以执行操作。

注意:此外,请确认 Blob 存在于相应租户下的相应资源组和订阅中。

确保您使用注册表名称证明

.
分隔符,没有遗漏它。

可能与目前开发预览中的

--agent-pool
参数有关

为了避免冲突,您可以使用以下命令格式来构建ACR的镜像。

az acr build -t sample/hello-world:{{.Run.ID}} -r latestjahreg .  --resource-group xxxx

enter image description here

我也尝试过与您类似的命令,并且能够成功执行它,如下所示。

az acr build --agent-pool MyAgentName -t webimage:latest -f Dockerfile https://github.com/MicrosoftDocs/mslearn-deploy-run-container-app-service.git --registry latestjahreg --resource-group xxx

enter image description here

enter image description here

参考MS Doc博客

© www.soinside.com 2019 - 2024. All rights reserved.