Michael Stone wrote: > Debian is a general purpose OS that can form the foundation for a lot > of variants. But, that flexibility has a cost, and the cost is size & > complexity. /var/lib/apt and /var/lib/dpkg alone are the size of a > minimal linux distribution, without even accounting for actual > executables. You can shrink the minimal set by making some components > replaceable, but for a general purpose OS that implies the 60k > update-alternatives program plus /etc/alternatives plus > /var/lib/dpkg/alternatives--all to support reconfiguration that won't > ever happen in a container image.
Omitting whole directories like /var/lib/dpkg and /var/lib/apt (for finalized containers that will never get more packages installed atop them), or /usr/share/{doc,info,man,locale} (for most containers) is straightforward and easy, and any container optimizing for size starts there. And the extra symlinks in `/etc/alternatives` don't take much size; I agree you don't need update-alternatives, but then, you also don't strictly need the entire dpkg and apt packages, if you're already omitting their files under /var/lib. Omitting other packages is harder, and more error-prone. And that's the area where `Essential` makes it much harder. If there were explicit dependencies, it'd be a matter of carefully pruning the DAG, rather than a matter of carefully manually checking what has an unststated dependency on what.