Start Linux Containers (LXC) at Startup


The built in possibility on Ubuntu / Debian is to change the configuration file /etc/default/lxc:

CONTAINERS="vm0 vm1"

In this example, vm0 and vm1 are LXC configuration files stored or linked in /etc/lxc. These containers will be started at startup.

custom init script /etc/init.d/lxc

Instead of the init script shipping with Ubuntu and Debian, you can use a custom init script (/etc/init.d/lxc) as the one from this commit on It does not make use of /etc/default/lxc to set up the containers to be run at startup but a mark.

one more way: /etc/init.d/lxc-watchdog

/etc/init.d/lxc-watchdog on phbaer/lxc-tools checks for the file /var/lib/lxc/*/on_boot and starts any associated container at startup. It can also start/stop single lxc containers and print their status. Not much different is