在 Azure DevOps 管道中将映像推送和拉取到 Azure 容器注册表任务失败。当尝试从本地系统拉取或推送时,没有问题,但是当尝试使用 Azure Devops 管道进行操作时,它会失败。Docker 登录成功,但是当我想从 acr 中提取图像时失败,结果如下:
来自守护程序的错误响应:头“ */a2/abcd/manifest/latest”:未经授权:客户端 ID 或客户端密码无效。
##[错误]Bash 以代码“1”退出。##[debug]Processed:##vso[task.issue type=error;]Bash 退出,代码为“1”。
我检查了 Az Devops 中的所有服务连接,它们看起来都配置正确。检查关联的服务主体是否具有 AcrPull 和 AcrPush 权限,它们都已到位。只是无法理解出了什么问题。
我的 Yaml 看起来像这样:
trigger: none
schedules:
- cron: "0 0 0 * *"
displayName: **** *
branches:
include:
- abcd
always: true
pool:
vmImage: 'ubuntu-latest'
variables:
- name: acrname
value: *****.azurecr.io
stages:
- stage: abcd
displayName: "pull images from acr"
jobs:
- job: abcdef
displayName: "abcdef"
pool:
vmImage: ubuntu-latest
steps:
- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: '*****.azurecr.io'
- bash: |
docker pull $(acrname)/abc-def:latest
docker pull $(acrname)/igh-jkl:latest
name: pull
displayName: 'pull acr images'
任何人都可以帮忙吗?