liveBook · Manning

Image cache

As explained in Learn Docker in a Month of Lunches, Second Edition

An image cache is Docker Engine's local storage of container image layers for reuse by images and containers.

An image cache is Docker Engine’s local storage for image layers. Built and downloaded images remain available for reuse by other images and containers. section 3.3

The cache makes image reuse practical:

  • Docker reports each image’s logical size, but shared layers consume disk space only once. section 3.4
  • Shared image layers are read-only, preventing changes in one image from affecting other images that reuse them. section 3.4
  • Reusing common runtime layers can reduce disk usage and support smaller, faster image builds. section 3.4

Inspect and use a locally cached image

Build an image with `docker image build --tag web-ping .`, then list it with `docker image ls 'w*'`. The resulting `web-ping` image is stored in the local cache and can run with `docker container run -e TARGET=docker.com -e INTERVAL=5000 web-ping`. Use `docker system df` to inspect actual Docker disk usage rather than relying only on logical image sizes. section 3.3 section 3.4

docker system df

Inspect Docker’s actual disk usage, including space saved by shared image layers. section 3.4

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains logical versus physical size, shared read-only layers, and Docker disk inspection.
Examples
Uses docker image build, docker image ls, docker system df, and docker container run with web-ping.
What it assumes
Assumes basic Docker image-building and container-running commands while teaching layer sharing through practical output.
What you can do after
Operate Docker’s image cache with docker image ls and docker system df, then run locally built images as containers.
How it connects
Connects Docker image layers with Dockerfiles, image builds, and containers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.