An image layer is an immutable record of filesystem changes made by one image-build step. Layers combine application code, dependencies, and operating-system files into a container image; later deletions cannot remove data stored in earlier layers. section 8.2.1
Use layer analysis to find and prevent image-size problems:
- Run docker history, or its Podman equivalent, to identify which build commands created the largest layers. section 8.2.1
- Use Dive to browse each layer's files and determine which directories, caches, or build tools consume space. section 8.2.1
- Combine installation and cleanup in the same build step, or use a multi-stage build, because later cleanup leaves earlier-layer data in the image. section 8.2.1
Checkout API image
A checkout API had a 1.3GB installation layer containing system packages, compiled extensions, build tools, and package caches; its full Debian base added another 412MB. A builder stage can retain those tools while the production stage copies only installed dependencies into a slim runtime image. section 8.2.1






