liveBook · Manning

Run instruction

Also called RUN command, RUN directive

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 →

Also covered in

What to know first

Related concepts

Questions about run instruction

What is run instruction?

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

Which Manning books explain run instruction?

Learn Docker in a Month of Lunches, Second Edition and Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more.

What should I know before learning run instruction?

Manning books that teach run instruction usually introduce container and package.json first.

What is the difference between run instruction and CMD instruction?

A Dockerfile RUN instruction executes a command during container image construction, producing filesystem changes that become part of the resulting image. The Dockerfile CMD instruction specifies the default command or arguments for a container started from an image, which can be overridden at runtime.

What is run instruction a kind of?

Run instruction is a kind of instruction. An instruction is a directive specifying an action, operation, task, constraint, or expected behavior for a person or computational system.

What is run instruction part of?

Run instruction is part of Dockerfile. A Dockerfile is a text file containing instructions for building a Docker container image.

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.