将镜像推送和拉取到 Azure DevOps 管道中的 Azure 容器注册表任务失败。当尝试从本地系统拉取或推送时,没有问题,但当尝试使用 Azure Devops 管道执行此操作时,则会失败。 Docker 登录成功,但当我想从 ACR 中提取镜像时失败,结果如下:
**Error response from daemon: Head "***/a2/abcd/manifest/latest": unauthorized: Invalid clientid or client secret.
##[error]Bash exited with code '1'.
##[debug]Processed: ##vso[task.issue type=error;]Bash exited with code '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'
有人可以帮忙吗?
最佳答案
- 我也遇到了同样的问题,ACR 服务连接已过期。因此,我必须使用这些步骤创建一个新的服务连接。
- Docker ID 和 Docker 密码可以从 ACR --> 设置 --> 访问 key 获取
- 使用这个新的服务连接更新您的管道,然后就可以开始了。如果此解决方案对您有帮助,请评价。
关于azure - 在 Azure Devops Pipeline 中将 Docker 镜像任务拉取和推送到 ACR 失败 "unauthorized: Invalid clientid or client secret.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70308425/