Hi,
At the moment kiwi supports the building of OCI compliant containers only. Target for these containers are OCI compliant runtimes, e.g docker, podman, ECR, etc etc and container runtimes that support import of OCI compliant container formats e.g containerd, k3s, kubernetes Unfortunately nothing of this applies to LXC. afaik on Ubuntu LXD is used as further development of the former LXC. If I understood it correctly the LXC developers moved the project into LXD with functionality of LXC still present. But I'm not an expert here. When I was implementing support for OCI containers to kiwi I was also looking into LXD/LXC but never finished or needed them. I stored the following information in my howto folder which actually tells you all you need. https://discourse.ubuntu.com/t/creating-custom-lxd-images/13970 The rootfs.tar.gz tarball you can create with kiwi using the image="tbz" type. The rest of the instructions is not implemented.
As I understood the relationship between LXC and LXD/Incus is a
bit like runC and Docker. The latter just makes it easier and
introduces the concept of "Container Images" with additional
functionality to make it more convenient to use. Proxmox for
example only uses LXC. It only needs a rootfs tarball and some
additional Proxmox related configuration to set the container up
(basically calling lxc manually through a pve tool wrapper).
Thanks for the link, actual low level information of LXC and LXD
is scarce. I only found
https://stgraber.org/2016/03/30/lxd-2-0-image-management-512/ but
a complete definition of the metadata attributes is still missing.
The divide between Canonical LXD and the community fork Incus
makes it even more confusing. Maybe a deeper look in the man pages
will shed some light on this topic.
I don't see a reason why this procedure won't work. It would be nice to have lxd support natively in kiwi, but unfortunately I won't have time to do it soon. I don't think it will be a big effort. You create a new builder class and inherit from the tbz builder, then add the code for the metadata and call "lxc image import" to produce the result.
Are you referring to the archive builder
(kiwi/builder/archive.py)? If so then this looks actually doable.
"lxc image import" is only needed on the target host that needs
to run the container later. So just creating the two tarballs
should be enough for kiwi.
As you need to run these steps anyway somehow, you could also consider to implement it in kiwi ;) We love contributions :)
There are some question-marks in regard to getting the required
data for the metadata from the xml config, but yeah I might give
it a try. But first I wanna try if the tarballs I created are
working with LXC. If this works I will setup the python
environment and give it a shot.
Regards
Sven