gpt4 book ai didi

azure-devops - 使用 devops 将 docker 镜像推送到私有(private) azure 容器注册表

转载 作者:行者123 更新时间:2023-12-05 03:19:27 24 4
gpt4 key购买 nike

所以我有一个私有(private) Azure 容器注册表,它本质上也位于私有(private) VNET 上(它必须这样做)。

我已将我的私有(private)容器注册表配置为:

"Allow trusted Microsoft services to access this container registry"

我还在我的 VENT 中允许 Microsoft Container registry 作为服务端点。

但是,当我使用以下代码在 devops 中推送我的图像时:

  variables:
# Container registry service connection established during pipeline creation
dockerRegistryServiceConnection: 'myacr'
imageRepository: 'my-image-repo'
containerRegistry: 'myacr.azurecr.io'
dockerfilePath: '$(Build.SourcesDirectory)/Dockerfile'
tag: '$(Build.BuildId)'
steps:
- task: Docker@2
displayName: Login to ACR
inputs:
command: login
containerRegistry: $(dockerRegistryServiceConnection)
- task: Docker@2
displayName: Build image with arguments
inputs:
command: build
arguments: --build-arg git_personal_token=MYTOKEN
repository: $(imageRepository)
dockerfile: $(dockerfilePath)
containerRegistry: $(dockerRegistryServiceConnection)
tags: |
$(tag)
- task: Docker@2
displayName: push the image
inputs:
containerRegistry: $(dockerRegistryServiceConnection)
repository: $(imageRepository)
command: push
tags: |
$(tag)

我得到错误:

denied: client with IP '51.145.2.107' is not allowed access. Refer https://aka.ms/acr/firewall to grant access.

但是,我无法在防火墙中设置 IP 地址,因为构建器 IP 会随着生成的每个唯一构建而变化。我以为我已经允许所有 Microsoft 服务正确访问,我是否遗漏了什么,或者我该如何进一步调试?

最佳答案

如果您有一个 Azure 容器注册表,您在其中禁用了公共(public)网络访问,您将无法从 Microsoft Hosted Azure Devops Agent 访问它。 .

Trusted services当前仅包含少量服务,但将来可能会添加更多服务:

  • Azure Container Instances
  • Microsoft Defender for Cloud
  • ACR Tasks
  • Machine Learning
  • Azure Container Registry

但是,不太可能添加 Azure DevOps(至少不是代理),因为 Microsoft 无法控制其中执行的代码(因此它们不受信任)。同样的原则适用于 Azure DevOps service tag ,其中不包括 Microsoft 托管代理。

如果您真的需要您的注册表完全私有(private),您将需要使用 self hosted agent部署在您自己的网络中,可以访问注册表。

关于azure-devops - 使用 devops 将 docker 镜像推送到私有(private) azure 容器注册表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/73444626/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com