Introduction
When building a Docker image, you often need to install software or prepare files. The RUN instruction lets you execute commands inside the image during build time to set it up exactly how you want.
When you want to install software packages inside your Docker image.
When you need to create or modify files during the image build.
When you want to update the system or clean up temporary files to keep the image small.
When you want to run scripts that prepare your app environment before the container runs.
When you want to set environment variables or permissions as part of the image setup.