InterviewBuddy
All interview questions

What is the benefit of a Docker multi-stage build?

Intermediate

Answer

Separate build stages from the final runtime stage, copying only the output and runtime dependencies needed to run the application.

Explanation

This reduces unnecessary tooling in the final image; it does not guarantee security by itself.

Example

Build with a compiler stage, then copy the binary into the runtime stage.