vagga
vagga copied to clipboard
Memory restrictions for container
Hey there, first of awesome project! I've recently started using vagga for a lot of my hobby coding projects and it's so much quicker to setup then docker.
I wanted to ask how difficult it would be to add memory restrictions to containers. This would be quite useful for certain tests, that take up a lot of memory on my system. I was able to apply said restrictions with docker and I miss this possibility a lot more, then I initially expected.
Thanks, Drakulix
For tests on memory usage you can use ulimit to restrict memory. You can run ulimit both inside the container and from the shell that you run vagga from whichever makes sense. Perhaps, you need to use ulimit -v, i.e. limit virtual memory rather than RSS, because the latter doesn't work in recent systems.
Docker uses cgroups for memory limits. Before kernel 4.6 we couldn't manipulate cgroup hierarchy from unprivileged process (and docker is running with elevated privileges). Since kernel 4.6 which have cgroup namespaces it should be possible to implement (but I haven't tried it). But besides kernel 4.6 you may need to use v2 (unified) cgroup hierarchy for your host system (I'm not sure if this is true, though). I'm not sure if there is any linux distribution that provides unified group hierarchy out of the box at this point. This needs a little bit experimentation. So this is not implemented yet, and we have no short term plans for it.
Alright I will play around with ulimit in the meantime.
I am using bleeding-edge software anyway, so 4.6 is not a problem, neither is a custom kernel config. But of course this may not apply to the majority of vagga users.
Feel free to close this issue, but if you tackle this anytime soon, please reopen/ping me.