推送到ContainerRegistry时访问被拒绝

时间:2019-05-14 07:37:03

标签: docker azure-devops azure-pipelines

我试图使用Azure YAML管道将docker映像构建推送到Azure容器注册表。但是在推送时我遇到了类似的错误

 "denied: requested access to the resource is denied
 ##[error]denied: requested access to the resource is denied
  ##[error]/usr/bin/docker failed with return code: 1"

下面是我为此使用的Azure yaml管道代码部分。还尝试通过删除includeSourceTags和AdditionalImageTags

variables:
  BuildConfiguration: "Release"
  AzureSubscription: "ea158397-eb3f-461a-94df-0eb6bbaada60"
  AzureContainerRegistry: "microservicecontainerregistry01.azurecr.io"
  KubernetesServiceEndpoint: "AKSServiceConnection"
  ResourceGroup: "microservicedelivery"

- task: Docker@1
  condition: eq(variables['fullCI'],True)
  displayName: 'Push runtime image'
  inputs:
    azureSubscriptionEndpoint: ${{variables.AzureSubscription}}

    azureContainerRegistry: ${{variables.AzureContainerRegistry}}

    command: 'Push an image'

    imageName: '$(imageName)'

    includeSourceTags: false

    additionalImageTags: $(Build.BuildId)

Microsoft托管计算机和私有计算机中都发生了相同的错误。

1 个答案:

答案 0 :(得分:0)

请参考文档here和示例YAML代码段,以帮助您将图像推送到ACR。