首页 > 解决方案 > Azure ACR 任务无法从 Azure 容器注册表中提取 docker 映像

问题描述

我正在关注这篇文章。我有一个 Azure 容器注册表,如下图所示,我已经定义了如下任务。

az acr task create \
--name krushnaTask \
--registry krushna \
--cmd python-hello \
--schedule "1 10 * * *" \
--context /dev/null

当 Azure 运行任务时,它给出以下错误:

2020/06/02 11:02:03 Alias support enabled for version >= 1.1.0, please see https://aka.ms/acr/tasks/task-aliases for more information.
2020/06/02 11:02:03 Creating Docker network: acb_default_network, driver: 'bridge'
2020/06/02 11:02:03 Successfully set up Docker network: acb_default_network
2020/06/02 11:02:03 Setting up Docker configuration...
2020/06/02 11:02:04 Successfully set up Docker configuration
2020/06/02 11:02:04 Logging in to registry: krushna.azurecr.io
2020/06/02 11:02:05 Successfully logged into krushna.azurecr.io
2020/06/02 11:02:05 Executing step ID: acb_step_0. Timeout(sec): 3600, Working directory: '', Network: 'acb_default_network'
2020/06/02 11:02:05 Launching container with name: acb_step_0
Unable to find image 'python-hello:latest' locally
docker: Error response from daemon: pull access denied for python-hello, repository does not   exist or may require 'docker login': denied: requested access to the resource is denied.
See 'docker run --help'.
2020/06/02 11:02:05 Container failed during run: acb_step_0. No retries remaining.
failed to run step ID: acb_step_0: exit status 125

可以做些什么来让 ACR 任务访问 docker 镜像?

Azure ACR 存储库映像 Azure ACR 任务详细信息

标签: azuredockerazure-container-registry

解决方案


我很确定问题是您需要输入图像,krushna.azurecr.io/python-hello:tag因为图像在您的 ACR 中。当您输入图像时python-hello,表示它是 Docker hub 中的公共 docker 图像,因此导致错误,因为它无法在 Docker hub 中找到该图像。更改如下命令,它将运行良好:

az acr task create \
--name krushnaTask \
--registry krushna \
--cmd krushna.azurecr.io/python-hello \
--schedule "1 10 * * *" \
--context /dev/null

推荐阅读