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