]> git.friedersdorff.com Git - max/notes.git/blob - content/lxd_as_docker_replacment.rst
38e8fc9199e2f245464abe904557f610a8324cf3
[max/notes.git] / content / lxd_as_docker_replacment.rst
1 LXD is a suitable Docker alternative
2 ====================================
3
4 :date: 2019-05-29 11:34 
5 :category: System Administration
6 :tags: lxd, docker, container, virtualisation 
7 :authors: Maximilian Friedersdorff
8 :summary: LXD is a suitable alternative to Docker on Gentoo
9 :status: draft
10
11 LXD is a good solution for OS level virtualisation (containers) on Gentoo. 
12 The package is up to date and the wiki article sufficiently detailed.
13
14 Installation (on Gentoo)
15 ------------------------
16
17 Installation proceeded fine using the usual methods.  The kernel configuration
18 for this package is rather critical.  Recent versions of the linux kernel (5.2?)
19 have replaced the `NF_NAT_MASQUERADE_IPV4` and `NF_NAT_MASQUERADE_IPV6` kernel
20 options with a version agnostic `NF_NAT_MASQUERADE` option. LXD may complain 
21 about this when it installs.  Additionally, it requires full ipv6 support for 
22 iptables, even when the ipv6 useflag is disabled, this took me a while to 
23 realise.
24
25 Graphical applications in containers with xpra
26 ----------------------------------------------
27
28 Graphical applications can be run in the container using ssh forwarding. An
29 arguably better solution is using xpra; it allows reattaching to the running
30 sessions after a loss of the network.  I currently run spotify in the container
31 using `xpra start ssh/cerium --start-child spotify`, which uses ssh as the
32 transport and authentication mechanism.  Both the host and the container need
33 to have xpra installed.
34
35 The Snappy package manager appears not to work
36 ----------------------------------------------
37
38 When installing spotify using the snappy package manager on an ubuntu container,
39 it complains about not being allowed to mount a squashfs container:
40
41 .. code-block:: bash
42
43     $ lxc exec cerium -- snap install spotify
44     error: system does not fully support snapd: cannot mount squashfs image using "squashfs":
45            mount: /tmp/sanity-mountpoint-808218672: mount failed: Operation not permitted.
46
47 I'm sure the workaround for this is relatively straightforward once I've 
48 figured it out what it is.  In the mean time, installing spotify from the debian
49 package was the easier solution.
50
51 Networking
52 ----------
53
54 I've resolved to creating a network bridge managed by the OS rather than LXD 
55 itself.  The host machine already sits behind a NAT and the automagical
56 networking that LXD was doing was causing some hard to diagnose issues.