Docker Tutorial · Building Images · Lesson 11 of 26
Choosing a Base Image
Full, slim, Alpine and distroless base images: size, compatibility and security trade-offs.
The options
| Base | Example | Size | Notes |
|---|---|---|---|
| Full distro | python:3.14 |
Large | Compilers and tools included; convenient for building |
| Slim | python:3.14-slim |
Medium | Debian with fewer packages; good default for runtimes |
| Alpine | python:3.14-alpine |
Small | musl libc: some compiled packages behave differently or build slowly |
| Distroless / static | gcr.io/distroless/static-debian13 |
Tiny | No shell or package manager; ideal for static binaries |
Smaller images pull faster and contain fewer packages that can have vulnerabilities. Pin versions
(python:3.14-slim, not python), rebuild regularly to pick up security fixes, and prefer official or
verified publishers.
for img in python:3.14-slim alpine:3.24 busybox:1.37 gcr.io/distroless/static-debian13; do
printf '%-36s %8s on disk\n' "$img" "$(docker image ls "$img" --format '{{.Size}}')"
done
echo "libc in python:3.14-slim: $(docker run --rm python:3.14-slim sh -c 'ldd --version 2>&1 | head -1 | cut -c1-30')"
echo "libc in alpine:3.24: $(docker run --rm alpine:3.24 sh -c 'ldd 2>&1 | head -1')"
Output
python:3.14-slim 180MB on disk alpine:3.24 13MB on disk busybox:1.37 6.77MB on disk gcr.io/distroless/static-debian13 6.65MB on disk libc in python:3.14-slim: ldd (Debian GLIBC 2.41-12+deb1 libc in alpine:3.24: musl libc (x86_64)
Run this on your computer — see “Get Started” for setup.
Test yourself
Why can Alpine-based images cause trouble for some Python or Node packages?
Alpine has no shellAlpine uses musl libc, so prebuilt wheels or binaries for glibc may not workAlpine is too bigAlpine can't run Python
Show answer
Answer: Alpine uses musl libc, so prebuilt wheels or binaries for glibc may not work
Many prebuilt packages target glibc; on musl they may need compiling or behave differently.