Translation(s): none

Linux Containers (LXC) provide a Free Software virtualization system for computers running GNU/Linux. This is accomplished through kernel level isolation. It allows one to run multiple virtual units simultaneously. Those units, similar to chroots, are sufficiently isolated to guarantee the required security, but utilize available resources efficiently, as they run on the same kernel.

For all related information visit :

Full support for LXC (including userspace tools) is available since the Debian 6.0 "Squeeze" release.

Current issues in Debian 7 "Wheezy":

You can also read some sub pages :


aptitude install lxc

aptitude install bridge-utils libvirt-bin debootstrap

Prepare the host

Add this line to /etc/fstab

cgroup  /sys/fs/cgroup  cgroup  defaults  0   0

Try to mount it (a reboot solves an eventual "resource busy problem" in any case)

mount /sys/fs/cgroup

Check kernel configuration :

# lxc-checkconfig 
Kernel config /proc/config.gz not found, looking in other places...
Found kernel config file /boot/config-2.6.32-5-amd64
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
Multiple /dev/pts instances: enabled

--- Control groups ---
Cgroup: enabled
Cgroup namespace: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: missing
Cgroup cpuset: enabled

--- Misc ---
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabled

Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig

Here, I've Cgroup memory controller: missing. If you want memory control via cgroups then the Kernel recompilation is needed.

RootFS creation

Debian 8 "Jessie"/testing

Same as Debian 7 (see below), though if you want to specify the suite or mirror, use environment variables:

SUITE=wheezy MIRROR= lxc-create -n myvm -t debian

Debian 7 "Wheezy"

LXC installs correctly on Wheezy (including a working Debian template since 7.4).


lxc-create -n myvm -t debian

which will prompt you on what distribution to install.

Then adapt network configuration in /var/lib/lxc/myvm/config, e.g. to plug it on libvirt's bridge:

lxc.utsname = myvm = veth = up = virbr0 = = 00:1E:62:CH:NG:ME

Other templates can be downloaded, before 7.4 we recommended the one referenced on the LXC container mailing list:

lxc-create -n myvm -t debian-wheezy
# or for a 32-bit container:
linux32 lxc-create -n myvm -t debian-wheezy

Debian 6.0 "Squeeze"

cp -a /usr/lib/lxc/templates/lxc-debian /usr/lib/lxc/templates/lxc-squeeze

lxc-create -n myvm -t squeeze -f /usr/share/doc/lxc/examples/lxc-veth.conf

Setup networked containers

Start and stop containers

Notes/warnings on starting and stopping containers:

Actual commands:

Bind mounts inside the container

By default only the container's filesystem is mounted inside the container (even if on the host, /var/lib/lxc/mycontainer/rootfs has other mount points).

To mount another filesystem in the container, add to /var/lib/lxc/mycontainer/config:

lxc.mount.entry=/path/in/host/mount_point /var/lib/lxc/mycontainer/rootfs/mount_moint none bind 0 0

and restart the container. The mount point will now be visible inside the container as well.

Both paths can be identical if necessary.



See also :

Known bugs and "got to know issues"

mknod -m 600 /var/lib/lxc/myvm/rootfs/run/initctl p

and add "sys_admin" to the lxc.cap.drop line in /var/lib/lxc/myvm/config ?


See also