Any Docker image is made up of different layers. These different layers are something we will fully understand practically when we build our own Docker images. For now, when we imagine any Docker image, we can think of it as a collection of different layers stacked on top of one another.
Core Characteristics of Layers
The Base Layer: There is always a base layer — which is generally a small-size layer containing the foundational operating system or core runtime environments (like Alpine Linux or Ubuntu minimal).
Immutability: The layers below are completely immutable (read-only). Once an image layer is built, it cannot be changed.
The Container Layer: Changes can only be made to the top-most container layer (the read-write layer), which is dynamically added when we spin up a new container from the image. Any files modified or written while the container is running exist only in this layer.
Layer Reusability ("Already Exists")
When we use different versions of the same image on the same machine (for example, version 1 and version 2), these images share many of the same underlying layers.
If we have already set up one version on our system, when we pull or set up the second version, Docker will display "Already exists" for the common layers. This happens because those layers were already downloaded with the first version, saving you time, bandwidth, and local storage space!