简体   繁体   English

拒绝:在 Azure DevOps 管道中检索权限失败

[英]Denied: retrieving permissions failed in Azure DevOps pipeline

I have my Azure DevOps pipeline to build a container.我有 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'

The DOCKERFILE has this line at the beginning DOCKERFILE 在开头有这一行

FROM myacrd1.azurecr.io/cellorbase:latest

When DevOps runs this line, I get the error当 DevOps 运行此行时,出现错误

Error response from daemon: Head https://***/v2/cellorbase/manifests/latest: denied: retrieving permissions failed来自守护进程的错误响应:Head https://***/v2/cellorbase/manifests/latest: denied: 检索权限失败

Step 1/22 : FROM ***/cellorbase:latest步骤 1/22:从 ***/cellorbase:latest

Head https://***/v2/cellorbase/manifests/latest: denied: retrieving permissions failed头 https://***/v2/cellorbase/manifests/latest: denied: 检索权限失败

##[error]Head https://***/v2/cellorbase/manifests/latest: denied: retrieving permissions failed ##[error]Head https://***/v2/cellorbase/manifests/latest: denied: 检索权限失败

##[error]The process '/usr/bin/docker' failed with exit code 1 ##[错误]进程'/usr/bin/docker'失败,退出代码为1

在此处输入图片说明

Basically, I can't pull an image from the Azure Container Registry but I can push an image to it via the pipeline.基本上,我无法从 Azure 容器注册表中提取映像,但可以通过管道将映像推送到它。

In the Settings under Service Connection I have connected and granted access permissions to all pipelines.Service Connection下的Settings ,我已连接并授予对所有管道的访问权限。

在此处输入图片说明

I saw other posts on Stackoverflow (for example this one ) but it is about push an image not to pull an image.我在 Stackoverflow 上看到了其他帖子(例如这个帖子),但它是关于推送图像而不是拉图像。

Do you have any idea how can I pull an image from Azure Container Registry avoiding errors?您知道如何从 Azure 容器注册表中提取映像以避免错误吗?

I found the issue and the solution.我找到了问题和解决方案。 Basically, I have to use Docker Compose instead of using the Azure Container Repository Login .基本上,我必须使用Docker Compose而不是使用Azure Container Repository Login

在此处输入图片说明

I wrote a step-by-step solution on this link .我在这个链接上写了一个循序渐进的解决方案。

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

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