gpt4 book ai didi

docker - Gitlab runner + autoscaling + scaled runner 选项

转载 作者:IT老高 更新时间:2023-10-28 12:45:33 25 4
gpt4 key购买 nike

我正在使用带有 docker+machine 执行程序的 gitlab 运行程序来启动 AWS 上的自动缩放运行程序。我想在运行者中使用 docker-in-docker setup 来构建容器,但我不知道如何为生成的运行者定义所需的 [runners.docker] 属性以启用 docker用法。

是否有可能以某种方式将一些配置信息传递给自动缩放的运行者?

最佳答案

你只需要在你的自动缩放运行器的 config.toml 中使用这个:

[runners.docker]
privileged = true

我使用 docker-in-docker 构建自己的 php 容器进行测试并将它们存储在 gitlabs 注册表中。见 https://gitlab.cwd.at/docker/php/builds/21582对于构建示例和 https://gitlab.cwd.at/docker/php/blob/master/.gitlab-ci.yml对于构建定义

在这里查看我当前的配置 - 它使用 S3 进行缓存和用于运行者的 digitalocean:

concurrent = 10

[[runners]]
name = "ec2-autoscale-runner"
url = "https://gitlab.mydomain.at/ci"
token = "12345"
executor = "docker+machine"
limit = 10
environment = ["COMPOSER_CACHE_DIR=/cache"]
[runners.machine]
OffPeakPeriods = [ # Set the Off Peak time mode on for:
"* * 0-9,18-23 * * mon-fri *", # - Monday to Friday for 12am to 9am and 6pm to 11pm
"* * * * * sat,sun *" # - whole Saturday and Sunday
]
OffPeakIdleCount = 0 # There must be 1 machine in Idle state - when Off Peak time mode is on
OffPeakIdleTime = 3550 # Each machine can be in Idle state up to 1200 seconds (after this it will be removed) - when Off Peak time mode is on
IdleCount = 0 # There must be 5 machines in Idle state - when Off Peak time mode is off
IdleTime = 3550 # Each machine can be in Idle state up to 600 seconds (after this it will be removed) - when Off Peak time mode is off
MaxBuilds = 100 # Each machine can handle up to 100 builds in a row (after this it will be removed)
MachineName = "auto-scale-%s" # Each machine will have a unique name ('%s' is required)
MachineDriver = "digitalocean" # Docker Machine is using the 'digitalocean' driver
MachineOptions = [
"digitalocean-image=21937863",
#"digitalocean-image=20969606",
"digitalocean-access-token=12345",
"digitalocean-region=fra1",
"digitalocean-size=4gb",
"digitalocean-private-networking",
"digitalocean-ipv6=true"
]
[runners.ssh]
user = "root"
identity_file = "/etc/gitlab-runner/id_rsa"
[runners.docker]
privileged = true
[runners.cache]
Type = "s3"
ServerAddress = "s3.amazonaws.com"
AccessKey = "1234"
SecretKey = "1234"
BucketName = "cwd-gitlab-cache"
BucketLocation = "eu-central-1"
Insecure = false

关于docker - Gitlab runner + autoscaling + scaled runner 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42431956/

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