✦ For everyone, free.

Practical knowledge for real and everyday life

Home

3.3.1 OS Base Images

A focused guide to OS Base Images, connecting core concepts with practical Docker and container operations.

OS base images provide a minimal installation of a particular Linux distribution as the starting point for a Docker image, giving the rest of the build access to that distribution's package manager, standard libraries, and conventions, without any application-specific tooling included by default.

Why Distribution Choice Still Matters in Containers

Even though a container shares the host's kernel rather than running its own, the distribution chosen as a base image still determines the package manager available, the C library implementation in use, and the versions of common system libraries — all of which affect compatibility with software installed later in the build.

FROM ubuntu:22.04
RUN apt-get update && apt-get install -y curl
FROM alpine:3.19
RUN apk add curl

Both achieve the same practical goal, but rely on entirely different package managers and underlying C library implementations, which can matter for certain compiled dependencies.

Comparing Common OS Base Images

Different distributions trade off image size against included tooling and ecosystem compatibility: a minimal distribution produces smaller images but may lack tools or library compatibility that a fuller distribution provides out of the box.

docker images --filter reference='ubuntu' --filter reference='debian' --filter reference='alpine'

Comparing reported sizes across these distributions highlights just how significant base image choice can be for overall image footprint.

Slim and Minimal Variants

Many distributions offer explicitly minimized variants of their standard images, stripping out documentation, optional packages, and other content not strictly necessary to run typical workloads.

FROM debian:bookworm-slim
Why OS Base Image Choice Matters

Choosing an OS base image is rarely just a matter of personal preference — it directly affects build compatibility with specific dependencies, final image size, and the available surface for installing additional tooling, making it one of the more consequential early decisions in designing a Dockerfile.

Content in this section