【问题标题】:Use ACR as a Container Resource将 ACR 用作容器资源
【发布时间】:2019-06-25 08:18:17
【问题描述】:

在 Azure Devops 中,您可以使用“容器资源”在容器中运行管道,我正在尝试使用我推送到私人 acr 存储库的容器,但我终生无法找到任何可以让您连接它。我已经设置了一个“服务连接”并允许管道使用它。这是资源部分:

resources:
  containers:
  - container: infrastructure
    image: <acr-registry>.azurecr.io/<private-image>
    env:
      ARM_ACCESS_KEY: "$(arm_access_key)"
      ARM_CLIENT_ID: "$(arm_client_id)"
      ARM_CLIENT_SECRET: "$(arm_client_secret)"
      ARM_SUBSCRIPTION_ID: "$(arm_subscription_id)"

现在根据此您必须指定要使用“服务连接”https://docs.microsoft.com/en-us/azure/devops/pipelines/library/service-endpoints?view=azure-devops&tabs=yaml 但在 yaml 文档中 (https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#resources) 我没有看到任何地方指定要在资源部分使用的服务连接

【问题讨论】:

    标签: azure azure-devops azure-container-registry


    【解决方案1】:

    如果你想在构建过程中使用容器,可以按照官方文档:

    resources:
      containers:
      - container: string  # identifier (A-Z, a-z, 0-9, and underscore)
        image: string  # container image name
        options: string  # arguments to pass to container at startup
        endpoint: string  # endpoint for a private container registry
        env: { string: string }  # list of environment variables to add
        ports: [ string ] # ports to expose on the container
        volumes: [ string ] # volumes to mount on the container
    

    您需要使用端点来指定要使用的 docker 注册表连接

    https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#resources

    【讨论】:

    • 这是否意味着指定“服务连接”或仅指定 repo?
    • 我投了赞成票,因为它是正确的,但请注意,“端点”实际上是“服务连接”的名称,而不是 docker 注册表
    猜你喜欢
    • 2019-03-01
    • 2013-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多