Back to Docker
🏗️
Phase 2
Building Images — Dockerfiles & BuildKit
How layers, caching and the build context really work, and how to use the modern builder properly. This is where image size, build speed and most accidental credential leaks are decided.
1
Layers and the Build Cache: Why Your Rebuilds Are Slow
One rule governs Docker build speed and image size. Learn how layer caching invalidates, why instruction order matters, and what .dockerignore quietly prevents.
dockerdockerfilelayers
2
BuildKit and Buildx: Cache Mounts, Build Secrets, Multi-Platform
Persist package caches across builds, use credentials without leaking them, and build for ARM and x86 at once — with the default builder.
dockerbuildkitbuildx
3
Multi-Stage Builds and Choosing a Base Image
How a 2.2GB image becomes 145MB — separating the build environment from the runtime, and picking a base image with eyes open about the tradeoffs.
dockermulti-stagedistroless