Understanding Image Layers
If we rebuild images without any changes, it is observed that docker builds images superfast this time around. This is because Docker determines that you do not really need to run certain commands again and hence will just use the cache in such cases.
Whenever an image is being built, docker caches every single instruction and the result of that instruction. Upon rebuilding this image, docker uses cached instruction without having to re-execute the command. So, every instruction in the Dockerfile represents a LAYER in the image.
Each instruction creates a new layer