Archival repost — originally published on my old blog on June 21, 2015, back when Alpine was still a dark-horse pick rather than the default. Already in English, lightly cleaned up for dev.to (fixed a few typos). Alpine did go on to become the mainstream slim-base choice — but it's not the automatic right answer anymore either: its musl libc trips up some native Node/Python modules, and DNS resolution has had known issues, which is why multi-stage builds and distroless images are now common alternatives for the same "smaller image" goal. My Dockerfiles and Docker Hub images are still up if you want to see what this looked like in practice.
Run docker images and you'll typically see images weighing several hundred MBs — even a simple container providing a single service ends up heavy. Why? Because the base images people reach for — Ubuntu, CentOS, Debian — are themselves very heavy.
Images based on BusyBox could have been an alternative, but they're too far from the full-featured Linux OSes we're used to, and building from BusyBox isn't straightforward — it often requires compiling from source.
Let me introduce Alpine Linux, a lightweight Linux distribution. Its popularity is growing fast in the Docker community. Once people discover it, they rebase their Dockerfiles onto it and are amazed how simple the switch was. I started using Alpine well before it became official on Docker Hub, building my own PHP/nginx/MariaDB containers instead of relying on the heavy official ones.
More and more images using Alpine as a base are showing up on Docker Hub. My own builds are public on Docker Hub — feel free to use and fork them on GitHub.
Top comments (0)