Closed ilusharulkov closed 1 year ago
Why memory limit is ignored when using minimal tag image?
Because the minimal image is configured to use the host's cgroup namespace instead of creating a new one for the container, see here. (For this reason the minimal image comes with crun instead of runc as container runtime.) This is to be able to run containers within environments where you don't have permissions to create new namespaces, e.g. within another container.
Thus, if you want to set resource limits, you need to use the non-minimal image (or use its containers.conf
with the minimal image).
Hello! Thx for your great job, this is awesome! I have a problem with memory restriction for nested container. For example, let's create a golang app which consumes 400mb ram:
compile and run it:
The output is (on my machine):
which is 412.29 mb
Now, run this app in container, using
minimal
tag:The output is (on my machine):
The app was executed correctly and printed
400mb
, but limit was-m 100m
.Howewer If we will use image
4.6.1
the app exited with 137 code, which is (i guess) correct.The output is:
Exit status: 137
Let's rise limit (100 mb -> 500mb):
The output is:
Exit status: 0
My question is: Why memory limit is ignored when using
minimal
tag image?