azure - 在 Azure Devops Pipeline 中将 Docker 镜像任务拉取和推送到 ACR 失败 "unauthorized: Invalid clientid or client secret."

标签 azure docker yaml azure-pipelines acr

将镜像推送和拉取到 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 中的所有服务连接,它们看起来都配置正确。还检查了关联的服务主体是否具有 AcrPullAcrPush 权限,所有这些权限都已到位。只是无法理解出了什么问题。

我的 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'

有人可以帮忙吗?

最佳答案

  1. 我也遇到了同样的问题,ACR 服务连接已过期。因此,我必须使用这些步骤创建一个新的服务连接。

enter image description here

  • Docker ID 和 Docker 密码可以从 ACR --> 设置 --> 访问 key 获取
  • enter image description here

  • 使用这个新的服务连接更新您的管道,然后就可以开始了。如果此解决方案对您有帮助,请评价。
  • 关于azure - 在 Azure Devops Pipeline 中将 Docker 镜像任务拉取和推送到 ACR 失败 "unauthorized: Invalid clientid or client secret.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70308425/

    相关文章:

    azure - 从 azure CLI 获取租户名称

    azure - 在 DevOps 管道 ("az"命令中使用 Azure CLI v2 ML 扩展)

    docker - 如何在Centos的生产环境中运行docker容器?

    python - 以更简洁的方式转储 OrderedDict

    spring-boot - Spring Boot YAML 绑定(bind) : Failed to bind properties

    Azure Spark SQL 与 U-SQL

    azure - 使用 Azure 机器学习预测所选的抵押贷款类型

    docker - .m2的Docker缓存在本地不起作用

    azure - 如何将 docker 镜像发布为 azure devops 中的工件

    amazon-web-services - 在 Cloudformation 中实现此条件时,为什么我会看到 'did not find expected node content'?