1 min read 98 words Updated Sep 24, 2026 Created Sep 24, 2026
#docker#review

alpine is not always better

alpine lacks the standard C library which is required for many libraries of programming languages. Thus, in alpine, everything has to be rebuilt.

slim is often a better replacement.

Do multi-stage builds

Common bad practice: Use the default Golang image for the entire container. The one for Go is quite big, but docker offers copy from scratch explicitly to run compiled programs. Thus, the resuling container is only a couple of megabytes.

Order is important for caching

usually: install dependencies first, then copy over the actual code

Utilities

https://github.com/immanuwell/dockerfile-roast