multi-stage Docker builds Explained

What multi-stage Docker builds does, with an example.

Published November 10, 2026

multi-stage Docker builds use multiple FROM statements in one Dockerfile to keep build tools out of the final, smaller production image.

Key points

  • Part of the standard Docker CLI used for building, running, and managing containers

Example

FROM node:20 AS build
RUN npm run build
FROM nginx
COPY --from=build /app/dist /usr/share/nginx/html
More General articles