The built in possibility on Ubuntu / Debian is to change the configuration file
RUN=yes CONF_DIR=/etc/lxc CONTAINERS="vm0 vm1"
In this example,
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 github.com. 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 http://sysadmin-cookbook.rot13.org/#lxc_watchdog_sh.
- Tutorial on how to set up a linux container on Debian (incl. autostart): http://mindref.blogspot.com/2011/01/debian-lxc-create.html