distrobuilder is an integration tool used to create LXC or LXD container images. It takes a YAML-formatted configuration file as input and generates compressed image files which can be imported to a local repository or provided remotely via a repository server.
distrobuilder requires overlay filesystem support in order to work.
File systems ---> <*> Overlay filesystem support
emerge --ask app-emulation/distrobuilder
app-emulation/distrobuilder does not include any YAML templates. The upstream templates can be a useful guide when generating custom images. They may be found at github.com/lxc/lxc-ci.
Like docker, distrobuilder builds images by following definitions from a YAML file.
The YAML template
The upstream Gentoo templates are intentionally kept very slim. What follows are some sensible improvements.
Package management is determined by the packages: section:
packages: manager: portage update: false cleanup: true sets: - packages: - cloud-init action: install variants: - cloud - packages: - gentoo-kernel-bin - grub - syslog-ng - sys-power/acpid action: install types: - vm
- packages: demarcates the section.
- manager: tells distrobuilder what package manager the image uses. portage is predefined.
- update: If set to
true, all installed packages are updated at the time the image is created. The upstream templates use the stage 3 tarball and have
update: false, which means the repo directory in the container is empty and
portagewill fail. To avoid this, set
update: truewill make the image larger.
- cleanup: If set to true, the package manager will perform a cleanup operation to which usually cleans up cached files. It is not clear what operation this makes
- sets: Contains a list of packages following a bullet point
-and the keyword
action:, and optional filters such as
types. The packages are defined using standard portage package atoms;
action:must be set to either
typesdetermine whether a container or a virtual machine is built; this is set via a switch to distrobuilder at the time of image creation. Similarly,
variantsallow different configurations based on the same base template.
packages: manager: portage update: true cleanup: true sets: - packages: - sys-apps/portage - www-servers/nginx - net-misc/openssh - app-portage/eix - app-editors/vim - app-portage/gentoolkit - app-portage/portage-utils - app-admin/eselect - sys-apps/mlocate - app-admin/sysklogd action: install - packages: - cloud-init action: install variants: - cloud - packages: - gentoo-kernel-bin - grub - syslog-ng - sys-power/acpid action: install types: - vm