Building images, topic 22 of 41
Small and lean images
An image's size is mostly its base. A full distribution image is hundreds of megabytes; a slim variant, Alpine, a distroless image or scratch for a static binary can be a tenth of that.
Smaller is not everything: Alpine's musl libc can surprise a program built for glibc, and a distroless image has no shell to debug with. Pin the base's version, clean package caches in the same RUN that made them, and run one process per container.
On Opsfolk
Nothing of ours for this topic yet: an article is on its way.
Elsewhere
- Building best practicesOfficial
- Docker Hardened ImagesOfficial