LXD
LXD is a next generation system container manager. It offers a user experience similar to virtual machines but using Linux containers instead. It allows an easier management and deployment of LXC containers.
Prerequisites
- Enable the community repository
- Enable D-Bus (needed for some containers as they refuse to start if unavailable)
Installation
Then, install the lxd package and other necessary packages:
# apk add lxd lxd-client lxcfs
Configuration
Set some options to be able to run the containers as unprivileged:
# echo "session optional pam_cgfs.so -c freezer,memory,name=systemd,unified" >> /etc/pam.d/system-login # echo "lxc.idmap = u 0 100000 65536" >> /etc/lxc/default.conf # echo "lxc.idmap = g 0 100000 65536" >> /etc/lxc/default.conf # echo "root:100000:65536" >> /etc/subuid # echo "root:100000:65536" >> /etc/subgid
If you plan to run systemd based Linux distributions (Debian, Ubuntu, etc.), add this to /etc/conf.d/lxc file:
Contents of /etc/conf.d/lxc
and enable both lxc and lxd to start at boot:
# rc-update add lxc # rc-update add lxd # rc-update add lxcfs
Reboot and lxd should be working.