Book Image

Containerization with LXC

By : Konstantin Ivanov
Book Image

Containerization with LXC

By: Konstantin Ivanov

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
About the Author
About the Reviewer
Customer Feedback

Building and manipulating LXC containers

Managing the container life cycle with the provided userspace tools is quite convenient compared to manually creating namespaces and applying resource limits with cgroups. In essence, this is exactly what the LXC tools do: creation and manipulation of the namespaces and cgroups we saw in Chapter 1, Introduction to Linux Containers. The LXC tooling implements functions defined in the liblxc API, as we'll see in Chapter 4, LXC Code Integration with Python.

LXC comes packaged with various templates for building root filesystems for different Linux distributions. We can use them to create a variety of container flavors. For example, running a Debian container on a CentOS host. We also have the option of building our own root filesystem with tools such as debootstrap and yum, which we will explore shortly.

Building our first container

We can create our first container using a template. The lxc-download file, like the rest of the templates in the templates...