繁体   English   中英

Azure ACR 任务无法从 Azure 容器注册表中提取 docker 映像

[英]Azure ACR task not able to pull the docker image from Azure container registry

我正在关注这篇文章。 我有一个 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 任务详细信息

我很确定问题是您需要将图像输入为krushna.azurecr.io/python-hello:tag因为图像在您的 ACR 中。 当您将图像输入为python-hello时,这意味着它是 Docker 集线器中的公共 docker 图像,因此导致错误,因为它在 ZC5FD214CDD0D2B3B427Z2E73B022BA5C2 集线器中找不到图像。 更改如下命令,它将运行良好:

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

创建 ACR 任务时,如果您的注册表启用了 RBAC,则应提供 git-access-token

--git-access-token
The access token used to access the source control provider.

https://docs.microsoft.com/en-us/cli/azure/acr/task?view=azure-cli-latest#az-acr-task-create

您可以从此文档创建访问令牌

https://docs.microsoft.com/en-us/azure/container-registry/container-registry-tutorial-quick-task#configure-registry-authentication

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM