LXD: Difference between revisions

From Alpine Linux
(Created page with "= Introduction = [https://linuxcontainers.org/lxd/introduction/ LXD] is a next generation system container manager. It offers a user experience similar to virtual machines but...")
 
(Add instructions to install on stable)
Line 3: Line 3:
It allows an easier management and deployment of [[LXC]] containers.  
It allows an easier management and deployment of [[LXC]] containers.  


For now, Alpine Linux has a LXD package only for Edge so, first of all, you have to upgrade to Edge.
For now, Alpine Linux has a LXD package only for Edge so, first of all, you have to enable edge repositories.
 
Edit your /etc/apk/repositories:
 
  http://dl-cdn.alpinelinux.org/alpine/v3.14/main
  http://dl-cdn.alpinelinux.org/alpine/v3.14/community
  @edge http://dl-cdn.alpinelinux.org/alpine/edge/main
  @edge http://dl-cdn.alpinelinux.org/alpine/edge/community
  @edge http://dl-cdn.alpinelinux.org/alpine/edge/testing


Then, let's start installing lxd and dbus packages (dbus is needed for some containers as they refuse to start if unavailable)
Then, let's start installing lxd and dbus packages (dbus is needed for some containers as they refuse to start if unavailable)


   apk add lxd dbus
   apk add lxd@edge dbus


Then, let's set some options to be able to run the containers as unprivileged:
Then, let's set some options to be able to run the containers as unprivileged:

Revision as of 08:51, 3 November 2021

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.

For now, Alpine Linux has a LXD package only for Edge so, first of all, you have to enable edge repositories.

Edit your /etc/apk/repositories:

 http://dl-cdn.alpinelinux.org/alpine/v3.14/main
 http://dl-cdn.alpinelinux.org/alpine/v3.14/community
 @edge http://dl-cdn.alpinelinux.org/alpine/edge/main
 @edge http://dl-cdn.alpinelinux.org/alpine/edge/community
 @edge http://dl-cdn.alpinelinux.org/alpine/edge/testing

Then, let's start installing lxd and dbus packages (dbus is needed for some containers as they refuse to start if unavailable)

 apk add lxd@edge dbus

Then, let's 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 at boot:

 rc-update add lxc
 rc-update add lxd

If you have problems, try to enable dbus:

 rc-update add dbus

Reboot and lxd should be working.