LXC Cheet Sheet

  1. aptitude install lxc bridge-utils libvirt-bin debootstrap
  2. lxc-checkconfig
  3. $ more /etc/lxctl/lxctl.yaml
  4. $ cd /var/lib; sudo mv lxc ../../home; sudo ln -s ../../home/lxc .
  5. $ sudo lxc-create -n arduino -t debian -- -r jessie - edit /home/lxc/arduino
lxc-checkconfigCheck kernel configuration of host
lxc-lsList existing containers
lxc-create -t download -n mycontainer -- -d ubuntu -r trusty -a amd64Create an (unstarted) container. Other architectures include: i386
lxc-ls --fancyContainer info
lxc-start -dStart in background
lxc-consoleAttach to running container
lxc-clone [source] [target]
lxc-create -t [template] -f [config file]
lxc-execute -n [name] -- [command] # Run command in new container
lxc-attach -n [name] -- [command]Run command in running container
lxc-monitorMonitor containers for state changes
lxc-waitWait for a state change
lxc-infoGive details on a container
lxc-start -n mycontainer -dBoot up a container -- excluding -d will also run lxc-console
lxc-attach -n mycontainerExecute a root shell inside of a started container
lxc-console -n mycontainerOpen a login screen inside of a started container
lxc-stop -n mycontainerShut down a started container


Enable memory cgroup support (CONFIG_CGROUP_MEM_RES_CTLR, 534964, builtin since 2.6.39-bpo60-2 for Squeeze). It is deactivated by default. You need to activate it with a kernel parameter. When using grub2, this can be easily done by setting GRUB_CMDLINE_LINUX="cgroup_enable=memory" in /etc/default/grub and running update-grub2.

Same goes for swap+memory (CONFIG_CGROUP_MEM_RES_CTLR_SWAP), kernel parameter "swapaccount=1" - see http://lists.debian.org/debian-kernel/2012/01/msg00804.html.