What are Docker image “layers”?

I am brand new to Docker and am trying to understand exactly what a Docker image is. Every single definition of a Docker image uses the term “layer”, but does not seem to define what is meant by layer.

From the official Docker docs:

We’ve already seen that Docker images are read-only templates from which Docker containers are launched. Each image consists of a series of layers. Docker makes use of union file systems to combine these layers into a single image. Union file systems allow files and directories of separate file systems, known as branches, to be transparently overlaid, forming a single coherent file system.

So I ask, what is a layer (exactly); can someone give a few concrete examples of them? And how do these layers “snap together” to form an image?

10 Answers
10

Leave a Comment