简体   繁体   English

(如何)我可以使用 gitlab-ci.yml 指定要用于服务的非 Docker 集线器映像吗?

[英](How) can I specify non-Docker hub image to be used for services with gitlab-ci.yml?

How can I specify the image to be used by a service in gitlab-ci.yml?如何在 gitlab-ci.yml 中指定服务使用的图像?

This is similar to the question here , where the answer was basically a very thorough copy and paste RTFM.这与此处的问题类似,答案基本上是非常彻底的复制和粘贴 RTFM。

I am using Gitlab runners on AWS EKS using gitlab's autodeploy.我使用 gitlab 的自动部署在 AWS EKS 上使用 Gitlab 跑步者。 Logging into the gitlab-runner, I had added登录到 gitlab-runner,我添加了

environment = ["FF_GITLAB_REGISTRY_HELPER_IMAGE=1"]

to /home/gitlab-runner/.gitlab-runner/config.toml This seemed to reduce the number of pulls to Docker./home/gitlab-runner/.gitlab-runner/config.toml这似乎减少了对 Docker 的拉取次数。 However, it seems that calls to但是,似乎调用

services:
    - mongo:latest

are really eating up the allowance of Docker pulls.真的吃光了 Docker 拉动的余量。 If the aforementioned documentation specifies how to authenticate with Docker for pulling images used in services or how to specify a private repository for services, I did not see it.如果上述文档指定如何使用 Docker 进行身份验证以提取服务中使用的图像或如何为服务指定私有存储库,我没有看到它。

I tried adding ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX} to the service specification ie services:我尝试将${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}添加到服务规范中,即服务:

  • ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/mongo:latest ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/mongo:latest

but that just broke the database checks - or at least didn't fix the issues with Docker's rate limit.但这只是破坏了数据库检查——或者至少没有解决 Docker 的速率限制问题。

We ended up removing the services from the gitlab-ci.yml file and just running the services with the pipeline by declaring the private images in /home/gitlab-runner/.gitlab-runner/config.toml :我们最终从gitlab-ci.yml文件中删除了服务,并通过在/home/gitlab-runner/.gitlab-runner/config.toml中声明私有图像来使用管道运行服务:

[[runners.kubernetes.services]]
        name = "gitlabexample.com/ourgroup/ourproject/mongo"
        alias = "mongo"

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

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