What is a docker image?
Docker image is a collection of repositories.
There could be multiple layers in a docker image.
While pulling a docker image we pull the top layer and along with it all the layers linked to it are also pulled.
The layers are linked in a parent child fashion, where the second top layer is the parent of top layer and so on.
The last layer is the root file system. Each layer is its own file system.
When the container is running, all the layers are merged and mounted to the container.
When the container is stopped, the merged mount is gone.
The changes in the file system of each layer is maintained in a separate diff folder and when the container starts the changes are also merged in the mount.