liveBook · Manning

Base image

As explained in Fast by Default

A base image is the starting container image from which another container image is constructed.

A base image is the starting container image from which another image is constructed. Its layers provide operating-system files and runtime support before application code and dependencies are added. section 8.2.1

Choose and inspect the base image as part of image-size management:

  • A full Debian base contributed 412MB of unnecessary documentation, man pages, and utilities to the checkout API image. section 8.2.1
  • A slim production base can exclude build-time tools when paired with a multi-stage Dockerfile. section 8.2.1
  • Inspect base-layer sizes with docker history and browse their files with Dive. section 8.2.1

Separating build and production bases

A Python build stage uses python:3.11 to install dependencies, while the production stage starts from python:3.11-slim and copies only the required files. section 8.2.1

Listing 8.6 Inspecting container image layers with docker history
docker history --human --no-trunc your-image:tag #A

Inspect each image layer and its size with docker history before investigating individual files. section 8.2.1

How Fast by Default covers it

How deep it goes
Explains base layers, their contents, and multi-stage replacement, but stops short of comparing image distributions systematically.
Examples
Uses a checkout API, full Debian and slim Python images, docker history, Dive, and a multi-stage Dockerfile.
What you can do after
Apply it via Dockerfiles by selecting slimmer production bases and inspecting layers for unnecessary files.
How it connects
Connects base images with container images, layers, Dockerfiles, image analysis, and multi-stage builds.

Also explained in

Compare how 8 books explain base image →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Fast by Default. The section links point to the parts of the book it draws on.