Skip to content
masterclass Buddy

Docker · Concept

Multi-stage build

Multi-stage builds use several Dockerfile stages. Build an application in one stage, then copy only its runtime files into a smaller final stage.

Last updated

Syntax

FROM <image> AS <stage-name>
COPY --from=<stage-name> <source> <destination>
docker build --target <stage-name> -t <tag> .

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • FROM
  • COPY --from
  • AS
  • docker build --target
  • BuildKit

Source: Multi-stage builds. Checked 2026-11-03.