Distrobuilder centos creates too large container mage

Latest template from jenkins.
centos 8, centos 8 Stream, rockylinux
all produce an squashfs file > 600MB

distrobuilder build-lxd --cache-dir=/tmp/rockylinux_8 --timeout 7200 /st3/images/distro/tmp/rockylinux /st3/images/distro/os/rockylinux_8 -o image.serial=20220420_09:27 -o image.architecture=x86_64 -o image.release=8 -o image.variant=default -o source.variant=boot

Please can you take a look @monstermunchkin

CentOS/RHEL images are pretty heavyweight by default without compression. For containers, one of the main reason is the use of all langpacks for glibc package (glibc-all-langpacks package or something like that) which can increase packages size. For example for Fedora images, the base Docker image used by Distrobuilder uses the glibc-minimal-langpack which helps to reduce RPM packages size by half (dunno why to be honest). I didn’t find a solution to use glibc-minimal langpack for my custom CentOS images for now (ruskofd/lxd-images: Manifests to build custom LXD container and virtual machine images using Distrobuilder (github.com)).

For VM images, I also remove the linux-firmware package for Fedora and CentOS images but it comes back on the next package upgrade if there any kernel update, because it’s a dependency for the kernel package…

Thanks for sharing Manifest and the simple but interesting idea of utilizing tempfs.

Similar, i try to build customized containers and keep the result image small as possible, but more radical by eliminating all those for the sake of legacy docs, man, manpages and much more, of decades ago where not much of online resources available.

Ubuntu comes out with 50M.

Also the image.yaml is dynamically and modular created from sub sets.

Yet I wonder, how using same image.yaml and distrobuilder parameter produces Centos 100M rootfs at jenkins and 600-700M on my server.

I’m investigating this. Jenkins builds the images with build-dir followed by pack-lxd. You are using build-lxd. In theory the output should be the same so there might be some bug in build-lxd.

I just built a Rocky Linux 8 image using build-lxd which results in a 128M squashfs.

What version of distrobuilder are you using? Can you also please paste the exact yaml template of your Rocky Linux build?

distrobuilder 2.0 1125 latest/stable stgraber classic
Alpine,ubuntu,fedora,opnesuse … all work fine, centos has worked till weeks ago.
Build dir is zfs.
Sometimes override above source with a closer distro repository, but result gradually same. Goes for all centos, 7,8,8-stream,9-stream, rockylinux …

├── [ 4] centos_7
│ ├── [ 832] lxd.tar.xz
│ └── [851M] rootfs.squashfs

@kamzar1 Do you have the same issue when using the latest/edge snap?

Thanks Thomas.
It works perfect now.

distrobuilder git-1176400 1334 latest/edge stgraber classic

├── [ 4] centos_7
│ ├── [ 852] lxd.tar.xz
│ └── [ 85M] rootfs.squashfs

Indeed, there is something “wrong” here using Distrobuilder stable release. I also saw this change since I use the edge release of Distrobuilder for few months. Before, I can finish with a huge image of 1GB for a CentOS container, but now, it’s really stripped as expected (even with my supplementary packages). I don’t remember having problems with Fedora nor Ubuntu images.