RUN — Execute Build Commands
DK · Dockerfilesyntax
RUN <command>
RUN ["executable", "arg1", "arg2"]example
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir -r requirements.txtNote Each RUN creates a new image layer. Combine related commands with && to reduce layers and image size. Always clean up package manager caches in the same RUN statement, or the cache ends up in a previous layer and is never actually removed.