Reusing image layers

As we already know, a Docker image consists of a series of layers combined with the union filesystem of a single image. When we work on building our Docker image, the preceding instructions in our Dockerfile are examined by Docker to check whether there is an existing image in its build cache that can be reused instead of creating a similar or duplicate image for these instructions.

By finding out how the build cache works, we can greatly increase the speed of the subsequent builds of our Docker images. A good example of this is when we develop our application's behavior; we will not add dependencies to our application all of the time. Most of the time, we will just want to update the core behavior of the application ...

Get Docker High Performance - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.