Dockerfile instructions

Dockerfile RUN

Runs a preparation command during a build; resulting filesystem changes can become part of the image. Cached results may be reused. Shell form supports redirection; exec form passes separate arguments. Avoid secrets and unreviewed downloads. Cache reuse is not evidence of execution in the current build.

Formal Syntax & Structure

docker syntaxdocker
RUN <command> | RUN ["executable", "arg", ...]

Parameters & Attributes

NameTypeDescription
commandstringFinite build-time operation.

Working Example

Example Snippetdocker
FROM busybox:1.37WORKDIR /appRUN printf "prepared\n" > report.txtCMD ["cat", "report.txt"]
Docker Reference