Distrobuilder template examples for generating LXD container images.
- Ubuntu 24.04 LTS (fresh instance is recommended)
- LXD
- LXD image builder
- debootstrap
- make
- mksquashfs
- dconf
- apt-cacher-ng
- protobuf-compiler
- squid-openssl
Required packages can be installed using apt install and snap install.
sudo snap install lxd
sudo snap install --edge --classic lxd-imagebuilder
sudo apt install debootstrap make squashfs-tools dconf-cli apt-cacher-ng protobuf-compiler squid-openssl
Squid can be configured by running a script in this directory.
./configure-squid.sh
The LXD service must be configured properly first.
# adds the current user to lxd group.
sudo usermod -aG lxd $USER
newgrp lxd
# checks your groups
groups
# configures the LXD service with defaults
lxd init --auto
Add a profile for image development.
lxc profile create develop
lxc profile edit develop < develop-profile.yaml
| Image name | Description | Parent image |
|---|---|---|
| base/bootstrap | Minimal image to boot | - |
| base/core | Command line tools | base/bootstrap |
| base/desktop | Minimal desktop with RDP | base/core |
| base/desktop-apps | Desktop with additional applications | base/desktop |
Invoking the command below builds all example images.
make
The following command imports the image built in the simple directory.
cd images/lxd/simple
lxc image import lxd.tar rootfs.squashfs --alias simple
# lists images
lxc image list
A container named test can be launched using the imported image.
lxc launch simple test -p develop
# lists containers
lxc list
The login credentials provided by the examples are user1/secret, which must be changed in production environment.