Interview Prep/Docker/Image design and Dockerfile decisions

Alpine or Debian slim for a Python app with compiled wheels?

IntermediateScenarioImage design and Dockerfile decisions
Answer

Situation read → Alpine uses musl libc; many PyPI wheels are built for glibc (manylinux).

What I'd do → Choose python:3.12-slim (Debian) for packages like numpy, pandas, grpcio, cryptography. Pick Alpine only if all dependencies have musllinux wheels or you accept compiling from source.

Why → On Alpine, pip often compiles from source, which makes builds slow and images larger after installing a toolchain, and can produce subtle runtime differences (DNS resolver, locale, performance).

Interview tip → "Smaller base is not always smaller final image."

All Docker questions Roadmap: Docker & containers

More on Image design and Dockerfile decisions