how to configure hard memory limit for builds in drone.io

◇◆丶佛笑我妖孽 提交于 2019-12-11 16:03:35

问题


Perhaps I am missing it, but I see no method to control the the hard memory limit for any given build (I have builds being murdered because of it). Is the build memory limit based on the build params supplied by the client (this means a single client can bring down everything) or is there someplace I can configure the service to only allow 512mb (for example) per build?


回答1:


You can limit the max amount of memory per-container by setting the global DRONE_LIMIT_MEM variable (with the server). This should be set to the amount of memory in bytes, for example:

DRONE_LIMIT_MEM_SWAP=512000000
DRONE_LIMIT_MEM=512000000

These limits are passed to Docker when Drone starts a container [1]. It is the equivalent to the following Docker command:

docker run --memory=512000000 <image>

[1] https://docs.docker.com/config/containers/resource_constraints/#limit-a-containers-access-to-memory



来源:https://stackoverflow.com/questions/52212437/how-to-configure-hard-memory-limit-for-builds-in-drone-io

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!