Limit number, memory and cpu of services container for docker runners
Proposal
Today we can limit the cpu and memory for docker build container. And the limits of services container is also needed to optimize the resource of the docker runner host.
I would like to write the config.toml
something like:
concurrent = 1
[[runners]]
executor = "docker"
[runners.docker]
cpus = "2"
memory = "4g"
services_limit = "1"
services_cpus = "1"
services_memory = "2g"
With there config, on this docker runner, it allow only one service container and it can only use 1 cpu and 2g memory. So the pipeline on total the maximum resource consummation is cpu 2 + 1 = 3 and memory 4g + 2g = 6g.
Assuming the machine has at least 4 cores and 8GB RAM, we can guarantee that ci containers should not affect other processes on machine. At least not by starving others of cpu time or running out of memory.
Thank you!
Edited by BAI Peng