liveBook · Manning

Run instruction

A Dockerfile RUN instruction executes a command during container image construction, producing filesystem changes that become part of the resulting image.

How 2 Manning books explain it

Learn Docker in a Month of Lunches, Second Edition

The RUN instruction executes a command while building a Docker image and commits its result to an image layer.

How it is used
Executes build-time commands for generating files, retrieving dependencies, compiling applications, and testing across Dockerfile stages.
How deep it goes
Explains execution, command availability, image layers, failure behavior, caching, multi-stage placement, and platform portability.
Examples
Uses echo file generation, Maven dependency retrieval, Maven packaging, and a multi-stage Dockerfile that copies generated artifacts.
What you can do after
Builds Docker images that generate artifacts, compile applications, reuse cached steps, and isolate build tools from runtime stages.

Read how Learn Docker in a Month of Lunches, Second Edition explains run instruction →

Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

The RUN directive executes a command in an intermediate container during image construction.

How it is used
Builds container images by running installation, update, and cleanup commands during image construction.
How deep it goes
Explains build-container execution and committed layers, but gives only one command example rather than detailed syntax variations.
Examples
Uses yum to update packages, install procps-ng, and clean package metadata so the image contains ps with less cruft.
What you can do after
Apply it via Podman to install packages and modify an image while preserving changes for subsequent build steps.

Read how Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more explains run instruction →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.