The RUN instruction executes commands in a new layer on top of the current image and commits the results. It is used to install software or make changes during image build.
Click to reveal answer
beginner
How do you write a RUN instruction to update package lists on a Debian-based image?
RUN apt-get update
Click to reveal answer
intermediate
What is the difference between using RUN with shell form and exec form?
Shell form: RUN command runs in a shell (e.g., /bin/sh -c), allowing shell features like variable expansion. Exec form: RUN ["executable", "param1", "param2"] runs directly without a shell.
Click to reveal answer
intermediate
Why should you combine multiple commands in a single RUN instruction?
Combining commands reduces the number of image layers, making the image smaller and more efficient.
Click to reveal answer
beginner
Example: How to install curl and clean cache in one RUN instruction?