Hi,
How is it possible to get a list of PID of processes that are running in particular container?
In the case of LXD 3.x (Ubuntu 18.04), the list is available in the /sys/fs/cgroup/pids/lxc/<cont_name>/cgroup.procs file.
In the case of LXD 4.0.9 (Ubuntu 18.04), the list is available in the /sys/fs/cgroup/lxc.payload.<cont_name>/cgroup.procs file.
Is there a similar file for LXD 4.0.9 on Ubuntu 21.10 ?
Thank you in advance.
I’m not completely sure that your method was actually reliable on cgroup1 as I don’t believe that cgroup.procs includes tasks in child cgroups, so you may have missed a bunch.
With cgroup2, cgroup.procs still exists but because processes are much more actively using the cgroup hierarchy, the top-level is now empty and you really do need to parse all the child cgroups.