Building a custom image from packages

i want to build many customized images based on installing a set of specific packages. i have done this kind of thing for VMs and embedded boards of a few architectures before. i plan to do this with and for containers. the way things have been done before was to use the packaging system’s installer with a target directory option, such as root=, to build a base system. this would be done outside of a container. then the container would be configured to use that base system as its rootfs. the container would be started to run a script to install the remaining packages, acquired and installed locally, if present in the local package cache, or over the network as needed.

what i would like to know is what considerations i might need to make to do this with lxd. if i have my own rootfs (and nothing more) for a system container, what more would i need to do this with lxd?

Have you looked at distrobuilder?

i have looked at it in another context. i already have the builder that puts together the rootfs i need. i presume i need more to make it be a container image. will distrobuilder work from an existing rootfs and do what i need to make it be a container?

this evening i found an old 2TB hard drive with an old Slackware system on it. it is 32-bit, but that should be runnable on a 64-bit kernel (i have done this before using just chroot). i definitrly want to run this old system even if i need to do it as chroot (or maybe chroot from inside a tiny container). this rootfs is about 1.6TB in size, so it must be run from where it is, not copied anywhere since i don’t have that much free space in one chunk (yet … i am inventorying my stacks of old hard drives).

that hard drive was built to be a rescue disk … a rescue disk on steroids. it was experimental to select the 64 bit kernel if the machine could run it, or fall back to a 32 bit kernel. userland is 32 bit either way (the same one big one). i can’t remember where i was in trying to get it to work. i want it, now, to be a 32-bit container.