About a year ago after building custom LXD images with Hashicorp’s Packer stopped working I started writing distrobuilder-menu to make it easier to build custom LXD / LXC images:
The distrobuilder-menu README should be clear enough to get most users up & running.
I provide examples to build images that incorporate shell
customization & cloud-init
configuration:
- Alpine Linux & Ubuntu base images
- Alpine Linux build environment (
alpine-sdk
installed on first boot - &cloud-init
removed on first boot) - Ubuntu Gitlab container (Gitlab installed on first boot)
dbmenu
follows a similar methodology to Packer with the idea being that you create:
- base image (that overrides a standard distrobuilder image - with shell customization’s etc you would like in every image)
- service image (with web services etc - that uses your base image as the source template)
Under the hood dbmenu
uses the Go version of yq
to merge template overrides & standard cloud-init
yaml into an existing template (using PyYaml for merging did not give good results)
I added incus
compatibility recently so dbmenu
should work for everyone.
-
Installation as an isolated app should always work (
pipx
is how I install at the moment): -
pipx install git+https://github.com/itoffshore/distrobuilder-menu.git
Updating LXD version data: /home/stuart/devops/distrobuilder/templates/lxd.json ...
Caching JSON data to: /home/stuart/devops/distrobuilder/templates/cache.json
Wrote configuration as json to: /home/stuart/devops/distrobuilder/templates/cache.json
Querying the Github REST API: https://api.github.com/repos/lxc/lxc-ci/contents/images
Downloading:
https://raw.githubusercontent.com/lxc/lxc-ci/main/images/nixos.yaml
Saved to: ==> /home/stuart/devops/distrobuilder/templates/images/nixos.yaml
Downloading:
https://raw.githubusercontent.com/lxc/lxc-ci/main/images/openwrt.yaml
Saved to: ==> /home/stuart/devops/distrobuilder/templates/images/openwrt.yaml
-
custom
templates are now auto regenerated as part of thestandard
template update / downloads (sincev0.2.1
) -
Empty input from every menu / choice returns you to the main menu (main event loop).
Hopefully you find dbmenu
useful:
Comments / criticism welcome - there’s always room for improvements ;o)