The issue with distrobuilder
not being able to run in a container has to do with specific YAML files that require to use mknod
. Such as to create an Ubuntu container image. Because you can create an Alpine container image with distrobuilder inside a LXD container.
The issue with mknod
will probably get resolved soon according to LXD 3.13 has been released It might work already on Ubuntu host, if you have Linux 5.0 or newer?
Compiling distrobuilder
should be easy. I wrote this, https://blog.simos.info/using-distrobuilder-to-create-container-images-for-lxc-and-lxd/ and also the distrobuilder project has the instructions.
Here is a full compilation walkthrough of distrobuilder, inside a LXD container.
lxc launch ubuntu:18.04 distrobuilder
lxc exec distrobuilder -- sudo --user ubuntu --login
Then, in the container.
sudo apt update
sudo apt install -y golang-go debootstrap rsync gpg squashfs-tools
go get -d -v github.com/lxc/distrobuilder/distrobuilder
cd ~/go/src/github.com/lxc/distrobuilder/
make
The generated binary is found at ~/go/bin/distrobuilder
. It is a self-container binary, and can be copied to the host.