LXD: Difference between revisions
(Alpine 3.16 contains lxd - you don't need to enable edge repositories anymore) |
(link to existing community, minor rewording) |
||
Line 3: | Line 3: | ||
It allows an easier management and deployment of [[LXC]] containers. | It allows an easier management and deployment of [[LXC]] containers. | ||
First, [[Repositories#Enabling_the_community_repository|enable the community repository]]. | |||
Then, install the lxd and dbus packages (dbus is needed for some containers as they refuse to start if unavailable) | |||
Then, | |||
apk add lxd lxd-client lxcfs dbus | apk add lxd lxd-client lxcfs dbus | ||
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 "session optional pam_cgfs.so -c freezer,memory,name=systemd,unified" >> /etc/pam.d/system-login | ||
Line 24: | Line 21: | ||
systemd_container=yes | systemd_container=yes | ||
and enable both lxc and lxd at boot: | and enable both lxc and lxd to start at boot: | ||
rc-update add lxc | rc-update add lxc |
Latest revision as of 06:40, 10 January 2023
Introduction
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.
First, enable the community repository.
Then, install the lxd and dbus packages (dbus is needed for some containers as they refuse to start if unavailable)
apk add lxd lxd-client lxcfs dbus
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:
systemd_container=yes
and enable both lxc and lxd to start at boot:
rc-update add lxc rc-update add lxd rc-update add lxcfs
If you have problems, try to enable dbus:
rc-update add dbus
Reboot and lxd should be working.