gpt4 book ai didi

azure-devops - Azure DevOps 本地缓存容器作业

转载 作者:行者123 更新时间:2023-12-05 06:09:45 26 4
gpt4 key购买 nike

我正在尝试运行 container job在本地构建和缓存的 Docker 镜像(来自 Dockerfile)中运行,而不是从注册表中拉取镜像。根据我目前的测试,代理只尝试从注册表中提取图像,而不是在本地搜索图像。我知道此功能没有记录,但我想知道是否有办法让它发挥作用。

stages:
- stage: Build
jobs:
- job: Docker
steps:
- script: |
docker build -t builder:0.1 .
displayName: 'Build Docker'

- job: GCC
dependsOn: Build
container: builder:0.1
steps:
- script: |
cd src
make
displayName: 'Run GCC'

最佳答案

恐怕暂时没有这种方法可以找到本地缓存的图像并在其上运行容器作业。

来自 the documentation你提到:

Containers can be hosted on registries other than Docker Hub. To host an image on Azure Container Registry or another private container registry

如果您在 YAML 文件中定义容器,它会默认从 docker hub 中提取图像。

或者您可以添加端点字段以指定其他注册表(例如 Azure Container Registry)。

容器的定义如下:

container:
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

这意味着容器作业将直接从注册表中提取图像,而不会搜索本地缓存。

但这个要求很有值(value)。

您可以在 our UserVoice site 上添加对此功能的请求,这是我们提供产品建议的主要论坛。

关于azure-devops - Azure DevOps 本地缓存容器作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64647697/

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