Introduction
When building Docker images, each RUN command creates a new layer. Combining multiple commands into one RUN reduces image size and speeds up builds by minimizing layers.
When you want to install multiple packages in one step to keep the image small
When you need to run several setup commands that depend on each other
When you want to clean temporary files after installation in the same step
When you want to reduce the number of layers to improve build speed
When you want to keep your Dockerfile clean and efficient