How check CGroup in the Linux file system supporting?
To check all types of cgroups that are allowed in Linux system we can check at /sys/fs/cgroup directory
How do we impose the container memory limits?
What's the default memory limit for docker containers?
Interestingly, when you don't define any control group on the memory limits, the docker engine will allocate the full memory of the VM as the maximum memory limit.
When you run the container with the 100m upper memory limit for the tomcat image. You can see the limit value docker stats command.
We can apply both the control group limits on the same container.
How to get the version of Cgroup?
Can we control of CPU load per container? How?
Yes it is possible to control the CPUs usage to container.
Control group helps us in define the limit, this can be decimal values that indicate CPU cycles - example here with 0.1
We can get the control group version and Driver value using `docker info` command.
We can have CPU Sets for creating new containers where we can share it with the other container as well. Here is an example, container lopri can be used with --cpuset-cpus=0 and share percentage using --cpu-shares=20 for busybox image. note that when no other container is running the whole CPU % will be alloted to the single container. When we have multiple container shares then it will be distributed the CPU as per the shares defined.
--cpu-shares int option will be used to define the CPU shares (relative weight)
--cpuset-cpus string option will be used for CPUs in which to allow execution (0-3, 0,1)