I want to soft limit cpu (80%) and hard limit memory to 2GB.
'free -h' in container always shows full memory. The limit doesn't work. Container is unprivileged.
Any idea how to get this working?
I've set this in lxc container 'config':
lxc.cgroup2.memory.max = 2048M
This is the host config:
$ cat /sys/fs/cgroup/cgroup.controllers
cpuset cpu io memory pids rdma
$ ll /sys/fs/cgroup
total 0
dr-xr-xr-x 9 root root 0 Sep 25 2024 .
drwxr-xr-x 6 root root 0 Sep 25 2024 ..
drwxr-xr-x 2 root root 0 Apr 20 19:24 lxc.monitor.ubuntu
drwxrwxr-x 6 root 100000 0 Apr 24 00:11 lxc.payload.ubuntu
drwxr-xr-x 2 root root 0 Apr 20 19:23 lxc.pivot
drwx------ 25 root root 0 Apr 23 23:52 services
dr-xr-xr-x 7 root root 0 Sep 25 2024 systemd
-r--r--r-- 1 root root 0 Apr 20 19:24 cgroup.controllers
-rw-r--r-- 1 root root 0 Apr 23 23:52 cgroup.max.depth
-rw-r--r-- 1 root root 0 Apr 23 23:52 cgroup.max.descendants
-rw-r--r-- 1 root root 0 Apr 23 23:52 cgroup.procs
-r--r--r-- 1 root root 0 Apr 23 23:52 cgroup.stat
-rw-r--r-- 1 root root 0 Apr 20 19:24 cgroup.subtree_control
-rw-r--r-- 1 root root 0 Apr 20 19:24 cgroup.threads
-r--r--r-- 1 root root 0 Apr 23 23:52 cpu.stat
-r--r--r-- 1 root root 0 Apr 23 23:52 cpuset.cpus.effective
-r--r--r-- 1 root root 0 Apr 23 23:52 cpuset.mems.effective
-r--r--r-- 1 root root 0 Apr 23 23:52 io.stat
-r--r--r-- 1 root root 0 Apr 23 23:52 memory.stat