Skip to content
Theory · Dockerfile, layers and the cache · lesson 2 of 8

Layers and the build cache

The first build of the shop's API image took a few seconds: Docker downloaded Python, installed Flask and copied the code. Change one line in app.py and build the image again — the new build finishes almost at once. To see what Docker redid and what it reused, you need to see what an image is made of.

In this lesson

  • An image is a stack of layers
  • The build cache
  • Let's check it on a build
  • Common mistake
  • Key points