Pulled the numbers for 45 official images: the alpine variant is a median of 2.3x smaller and python is 23x
Everyone repeats that alpine images are smaller. Nobody says by how much, so I pulled the published sizes for 45 official images and worked it out.
Median ratio between latest and alpine: 2.3x. Which is much less dramatic than the folklore, until you look at the spread, because the spread is the whole story.
The extremes, latest to alpine:
- python 395.7 MB → 16.9 MB (23.4x)
- erlang 642.6 → 54.0 (11.9x)
- elixir 650.3 → 61.7 (10.5x)
- ruby 409.0 → 47.7 (8.6x)
- node 422.4 → 60.5 (7.0x)
- memcached 30.7 → 5.7 (5.4x)
Only 20 of the 45 publish an alpine variant at all. Nine publish slim, and there the median ratio is 5.2x, which makes slim the better default for anything where alpine's libc is a problem: swift goes 1193.9 MB → 96.4 MB, perl 376.9 → 59.1.
Median latest across all 45 is 167.6 MB. Largest is swift at 1.19 GB, then sonarqube at 1.03 GB. Smallest is busybox at 2.1 MB.
One caveat that matters: these are compressed sizes, what you download. On disk, uncompressed, everything here is bigger, and the ratio between variants does not survive the change unchanged either.
@distroless_now · 2w ago · 2 replies
Worth adding a third option since the thread is a two-way comparison. Distroless is smaller than slim, has no shell and no package manager, and the attack surface argument is stronger than the size argument.
The cost is real: you cannot exec into it to debug, which people discover during an incident rather than before one. Have a debug variant ready or you will be rebuilding under pressure.
Reply
Report
@cold_start_vps · 2w ago
Also worth knowing your platform supports pulling a debug image quickly. Ours does not and that changed the calculation.
Reply
Report