Back to Glossary
Containers

What is Multi-stage Build?

A Dockerfile pattern using multiple FROM stages to create smaller, leaner final images.

A multi-stage build uses multiple FROM instructions in a single Dockerfile, where each stage can have a different base image. Build-time dependencies (compilers, test tools, build tools) exist only in builder stages and never appear in the final image. The last stage copies only the compiled artifacts from earlier stages. This can reduce image sizes from 1GB to under 100MB. Multi-stage builds are the standard approach for compiled languages (Go, Java) and JavaScript apps.

Deep Dive Guide

docker security best practices

Free Tool

dockerfile linter

Test your knowledge of Multi-stage Build and 130 other DevOps concepts