简体   繁体   English

GitLab 跑步者为每个作业拉取图像

[英]GitLab runner pulls image for every job

I have a GitLab runner using docker as the executor .我有一个 GitLab 跑步者使用docker作为执行者 My problem is, it pulls the image I have defined for every job, which takes more time to finish the pipeline我的问题是,它会提取我为每个作业定义的图像,这需要更多时间来完成管道

在此处输入图像描述

How can I cache the image and add a pull policy for the job or the runner ?如何缓存图像并为jobrunner添加拉取policy Anyone please?请问有人吗?

The pull policy by default for a docker executor is "Always". docker 执行程序的默认拉取策略是“始终”。 You can use "if-not-present" pull policy to make sure it is only pulled when it is not available locally.您可以使用“if-not-present”拉取策略来确保仅在本地不可用时才拉取它。

Read the documentation for option here and how the policies work here阅读此处的选项文档以及此处的政策如何运作

Check if the latest GitLab 13.8 (January 2021) can help.检查最新的GitLab 13.8 (2021 年 1 月)是否可以提供帮助。

Configure multiple image pull policies for Docker executor为Docker执行器配置多个镜像拉取策略

When your CI jobs are retrieving a container image from a container registry, a lost network connection can result in hours of lost development time and can negatively impact time-sensitive product deployments.当您的 CI 作业从容器注册表检索容器映像时,丢失的网络连接可能会导致数小时的开发时间损失,并对时间敏感的产品部署产生负面影响。

To address this resiliency problem, the GitLab Runner Docker executor now supports the use of multiple values for the pull_policy configuration, which is defined in the GitLab Runner config.toml file.为了解决这个弹性问题,GitLab Runner Docker 执行器现在支持对pull_policy配置使用多个值,该配置在config.toml文件中定义。

You can use these values, or stacked image pull policies, to configure combinations of pull policies and mitigate the impact caused by lost connectivity.您可以使用这些值或堆叠的图像拉取策略来配置拉取策略的组合并减轻因失去连接而造成的影响。

For example, if you configure pull_policy =[always, if-not-present] , the pull policy will always pull the image.例如,如果您配置pull_policy =[always, if-not-present] ,则拉取策略将always拉取图像。
However, if the target container registry is not available, the GitLab Runner Docker executor will fall back and use the if-not-present policy, which means a local copy of the image will be used for that pipeline job.但是,如果目标容器注册表不可用,则 GitLab Runner Docker 执行器将回退并使用if-not-present策略,这意味着该管道作业将使用映像的本地副本。

https://about.gitlab.com/images/13_8/runner-docker-pull-policy.png -- 为 Docker 执行器配置多个镜像拉取策略

See Documentation and Issue .请参阅文档问题

add [[runners]] [runners.docker] pull_policy = "if-not-present" to config.toml.添加[[runners]] [runners.docker] pull_policy = "if-not-present"到 config.toml。

how work: https://docs.gitlab.com/runner/executors/docker.html#how-pull-policies-work如何工作: https://docs.gitlab.com/runner/executors/docker.html#how-pull-policies-work

config.toml: https://docs.gitlab.com/runner/configuration/advanced-configuration.html config.toml: https://docs.gitlab.com/runner/configuration/advanced-configuration.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM