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

Chapter 4. LXC Code Integration with Python

This chapter will introduce you to the Python bindings provided by both the LXC and libvirt APIs. We'll explore which container functionalities are possible and which are not, using the upstream lxc-dev and python-libvirt packages on Ubuntu and the lxc-devel and libvirt-python packages on CentOS.

To gain the most out of this chapter, some knowledge of Python is required. If you are a developer, this chapter is probably the most important one for you.

In this chapter, we'll cover the following topics in this order:

  • Building and managing containers using the lxc Python bindings

  • Creating and orchestrating containers using the libvirt Python bindings

  • Using LXC as a backend for development and testing with Vagrant

  • Developing a simple frontend RESTful API to LXC, using the Bottle micro framework and the lxc libraries