Introduction
When you build a Docker image, each command creates a new layer. Squashing layers means combining these layers into fewer layers to make the image smaller and simpler.
When you want to reduce the size of your Docker image to save disk space and speed up downloads.
When you want to hide intermediate build steps and keep your image clean.
When you have many small layers from multiple RUN commands and want to combine them.
When you want to improve caching efficiency by reducing the number of layers.
When you want to optimize images for production deployment.