LXC takes advantage of the
freezer cgroup to freeze all the processes running inside a container. The processes will be in a blocked state until thawed. Freezing a container can be useful in cases where the system load is high and you want to free some resources without actually stopping the container and preserving its running state.
Ensure you have a running container and check its state from the
root@ubuntu:~# lxc-ls -f NAME STATE AUTOSTART GROUPS IPV4 IPV6 hooks_container RUNNING 0 - 10.0.3 root@ubuntu:~# cat /sys/fs/cgroup/freezer/lxc/hooks_container/freezer.state THAWED root@ubuntu:~#
Notice how a currently running container shows as thawed. Let's freeze it:
root@ubuntu:~# lxc-freeze -n hooks_container root@ubuntu:~# lxc-ls -f NAME STATE AUTOSTART GROUPS IPV4 IPV6 hooks_container FROZEN 0 - 10.0.3.237 - root@ubuntu:~#
The container state shows as frozen, let's check the cgroup...