Book Image

Containerization with LXC

Book Image

Containerization with LXC

Overview of this book

In recent years, containers have gained wide adoption by businesses running a variety of application loads. This became possible largely due to the advent of kernel namespaces and better resource management with control groups (cgroups). Linux containers (LXC) are a direct implementation of those kernel features that provide operating system level virtualization without the overhead of a hypervisor layer. This book starts by introducing the foundational concepts behind the implementation of LXC, then moves into the practical aspects of installing and configuring LXC containers. Moving on, you will explore container networking, security, and backups. You will also learn how to deploy LXC with technologies like Open Stack and Vagrant. By the end of the book, you will have a solid grasp of how LXC is implemented and how to run production applications in a highly available and scalable way.
Table of Contents (17 chapters)
Containerization with LXC
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Dedication
Preface

Freezing a running container


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 freezer cgroup:

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...