LXC is a userspace interface for the Linux kernel containment
Through a powerful API and simple tools, it lets Linux users easily create and manage system or application containers.
Current LXC uses the following kernel features to contain processes:
- Kernel namespaces (ipc, uts, mount, pid, network and user)
- Apparmor and SELinux profiles
- Seccomp policies
- Chroots (using pivot_root)
- Kernel capabilities
- Control groups (cgroups)
As such, LXC is often considered as something in the middle between a chroot on steroids and a full fledged virtual machine. The goal of LXC is to create an environment as close as possible as a standard Linux installation but without the need for a separate kernel.
LXC is currently made of a few separate components:
- The liblxc library
- Several language bindings (python3, lua, ruby and Go)
- A set of standard tools to control the containers
- Container templates
LXC is free software, most of the code is released under the terms of the GNU LGPLv2.1+ license, some Android compatibility bits are released under a standard 2-clause BSD license and some binaries and templates are shipped under the GNU GPLv2 license.
Where do I get it?
git clone git://github.com/lxc/lxc
In your distribution
LXC is packaged by most current Linux distributions, you can then simply install it using your package manager.
Below are some useful links for some of the Linux distributions that are most active in LXC development:
- LXC RPMs in Public-Yum [ol6_latest] channel
- Latest test/development LXC RPMs in Public-Yum [ol6_playground_latest] channel
- Oracle Linux Administrator's Solutions Guide chapter about LXC
How do I use it?
More details are available in the individual manpages shipped with LXC itself. But a basic example of how to create, start and stop a container would be as follow:
lxc-create -t ubuntu -n p1 lxc-start -n p1 -d lxc-ls --fancy p1 lxc-stop -n p1
The above will create a basic Ubuntu container called "p1", then start it in the background, get various information about the container including its IP address and finally stop it.
An equivalent using the python3 API would be:
import lxc container = lxc.Container("p1") container.create("ubuntu") container.start() container.get_ips() container.stop()
Additional examples about the API may be found in various documentation and howtos listed below. The C API documentation itself is auto-generated and available here.
How can I contribute to it?
Most development discussion happen on our
Patches are usually sent there for review and inclusion in
our master branch.
Frequent alpha releases and release candidates are tagged and packaged by some distributions.
Ubuntu users can also use our development packages available in ppa:ubuntu-lxc/daily
Where's the community?
As previously mentioned, most discussions happen on
We have two of those:
Some of us also hang out in #lxcontainers on irc.freenode.net
What about stable releases?
Our current stable release is LXC 1.0 which was released on the 20th of February 2014.
This release comes with 5 years of bugfix updates and occasional bugfix only releases (1.0.x). LXC 1.0 is the first release to have a dedicated stable branch with long term support but we expect to repeat this with later major releases.
Here's a list of external documentation, howtos and other relevant posts about current LXC: