簡體   English   中英

拒絕:在 Azure DevOps 管道中檢索權限失敗

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

我有 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 運行此行時,出現錯誤

來自守護進程的錯誤響應:Head https://***/v2/cellorbase/manifests/latest: denied: 檢索權限失敗

步驟 1/22:從 ***/cellorbase:latest

頭 https://***/v2/cellorbase/manifests/latest: denied: 檢索權限失敗

##[error]Head https://***/v2/cellorbase/manifests/latest: denied: 檢索權限失敗

##[錯誤]進程'/usr/bin/docker'失敗,退出代碼為1

在此處輸入圖片說明

基本上,我無法從 Azure 容器注冊表中提取映像,但可以通過管道將映像推送到它。

Service Connection下的Settings ,我已連接並授予對所有管道的訪問權限。

在此處輸入圖片說明

我在 Stackoverflow 上看到了其他帖子(例如這個帖子),但它是關於推送圖像而不是拉圖像。

您知道如何從 Azure 容器注冊表中提取映像以避免錯誤嗎?

我找到了問題和解決方案。 基本上,我必須使用Docker Compose而不是使用Azure Container Repository Login

在此處輸入圖片說明

我在這個鏈接上寫了一個循序漸進的解決方案。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM