Proxmox Linux container sizes (Alpine etc)
Continuing my Proxmox explorations, I’m looking for the smallest reasonable Linux container I can install to then do other things with. My starting point is Proxmox templates. Easiest to install with Proxmox tools but you can see the image sizes at the downloads here.
I’m mostly comparing the sizes of “df /”. That may not be a good measure. But for me it’s not just a measure of disk space, it’s also a proxy for memory usage and complexity. Of course I’m comparing systems without GUIs.
Alpine 3.18: 10MB
The gold standard for small Linux, really a lovely thing in just 10 MB. Hilariously almost half the storage (4MB) is in /lib/libcrypto.so.3, OpenSSL. I guess no one’s made a svelte SSL. Alpine gets to be so small by using libmusl instead of libc and replacing most of the userspace tools with busybox. The init is the very simple OpenRC. Despite that it has a huge number of packages you can easily install on top of it.
The downside is those replacements are very limited. The user space shell environment is enough to install something but can be frustrating. MUSL is also limited, see this post as an example of an obscure performance problem. It’s not bad, really it’s an impressive accomplishment, but it’d be nice to have an option that was both small and yet GNU libc based.
Debian 12: 540MB
Debian seems to be the default for a lot of Proxmox applications, but it’s half a gig on disk. From what I’ve read this is fairly pared down. Still it’s hard to quite understand where all the space is going. Some of it is just general system size. 136MB is shared libraries. 20MB for Perl, another 30MB for Python. Some of it seems superfluous: 50MB is locales (all of them?), 60 MB for the dpkg database, etc. It adds up.
One thing that’s encouraging is the Debian images keep getting smaller. Debian 12 is half the size of Debian 10!
Ubuntu: 640MB
No surprise, Ubuntu is bigger than Debian. More or less the same shape of things but just a little more of it.
Centos 9: 436MB
Not a fan of RedHat OSes but it’s a reasonable choice. Smaller than Debian but with similar sources of size. The locale library is 74MB! Also a 65MB GeoIP database that I bet isn’t necessary.
OpenSUSE 15.5: 178MB
I’d forgotten about OpenSUSE, to be honest, and am not sure whether it’s a good choice in 2023. It’s nicely small though! The bulk of it is binaries in /usr/lib64/ and /usr/bin. It’s still systemd and GNU libc. But there’s locale library at all, no python by default.. It meets the critera for “smaller”. Might be worth investigating what tradeoffs it implies.
Gentoo: 1800MB
Another distro I’d forgotten about, I picked this because in theory it supports musl. But not this template. And whoever built this was clearly not worried about size, it’s huge! There’s copies of package repos, SGML docbook, a 100MB test suite for Python, ... clearly no one spent time optimizing size here.
Other options
I should look beyond Proxmox templates. There’s a lot of other folks who’ve been working on the “smaller Linux for containers and VMs” idea. I should learn more about them. Docker’s got a bunch of them, in particular I keep seeing references to a “Debian Slim” that sounds promising. Docker’s overlay filesystem takes some of the sting out of bigger containers though, since the base OS storage can be shared.
Conclusions
I guess my ideal would be something with GNU libc but without systemd and without extra locales and binaries I don’t need. Ideally neither Perl nor Python required. Maybe what I want is “Alpine but with glibc and bash”. I’m willing to trade off some space for quality. I wonder if it’s realistic to be able to use pre-built Alpine MUSL packages for some things and glibc for others?
I’m probably overoptimizing. 540MB for Debian is probably what I should be using when Alpine won’t work, or maybe that 178MB OpenSUSE.