azure - 被拒绝 : retrieving permissions failed in Azure DevOps pipeline

标签 azure docker azure-devops azure-pipelines

我有 Azure DevOps 管道来构建容器。

trigger:
- main

resources:
- repo: self

variables:
  dockerRegistryServiceConnection: '...'
  imageRepository: '$(project)'
  containerRegistry: $(ACRLoginServer)
  dockerfilePath: '$(Build.SourcesDirectory)/DOCKERFILE'
  tag: '$(Build.BuildId)'
  azureContainerRegistry: azukschishinyacrd1.azurecr.io
  azureSubscriptionEndpoint: azukschishinyacrd1
  
  # Agent VM image name
  vmImageName: 'ubuntu-latest'

stages:
- stage: Build
  displayName: Build and push stage
  jobs:  
  - job: Build
    condition: not(eq('${{ variables.imageRepository }}', ''))
    displayName: Build
    pool:
      vmImage: $(vmImageName)
    steps:
    - task: Docker@2
      inputs:
        containerRegistry: $(dockerRegistryServiceConnection)
        command: 'login'
    - task: Docker@2
      displayName: Build and push an image to container registry
      inputs:
        command: buildAndPush
        repository: $(imageRepository)
        dockerfile: $(dockerfilePath)
        containerRegistry: $(dockerRegistryServiceConnection)
        tags: |
          latest
    - task: Docker@2
      inputs:
        containerRegistry: 'azukschishinyacrd1'
        repository: $(imageRepository)
        command: 'push'

DOCKERFILE 的开头有这一行

FROM myacrd1.azurecr.io/cellorbase:latest

当 DevOps 运行此行时,我收到错误

Error response from daemon: Head https://***/v2/cellorbase/manifests/latest: denied: retrieving permissions failed

Step 1/22 : FROM ***/cellorbase:latest

Head https://***/v2/cellorbase/manifests/latest: denied: retrieving permissions failed

##[error]Head https://***/v2/cellorbase/manifests/latest: denied: retrieving permissions failed

##[error]The process '/usr/bin/docker' failed with exit code 1

enter image description here

基本上,我无法从 Azure 容器注册表中提取镜像,但可以通过管道将镜像推送到其中。

服务连接下的设置中,我已连接所有管道并授予其访问权限。

enter image description here

我在 Stackoverflow 上看到了其他帖子(例如 this one ),但它是关于推送图像而不是拉取图像。

您知道如何从 Azure 容器注册表中提取镜像以避免错误吗?

最佳答案

我找到了问题和解决方案。基本上,我必须使用 Docker Compose,而不是使用 Azure 容器存储库登录

enter image description here

我对此写了一个分步解决方案link .

关于azure - 被拒绝 : retrieving permissions failed in Azure DevOps pipeline,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68543195/

相关文章:

Azure WebJobs 和 Visual Studio 2017

spring-boot - 在azure上部署后如何查看swagger

azure-devops - 如何重置 VSTS 计数器?

Azure:Azure 应用服务部署槽的定价

c# - MS Graph API Drive 创建新文件夹

linux - 在linux上安装后无法启动docker

Docker:如何在容器内挂载本地文件夹?

ssl - 是否可以为不安全的 docker 注册表提供 CA 签名证书,以便客户端自动信任它?

azure-devops - CI/CD 部署条件未触发

azure - 本地集群不允许本地 Service Fabric 集群中具有不同版本的相同应用程序类型