Skip to main content

Why should build tools be removed from production images?

Mid Docker
Quick Answer Build tools (compilers, make, npm in node_modules) are needed to build the app but not to run it. Including them bloats the image (hundreds of MBs) and adds unnecessary attack surface. Multi-stage builds solve this cleanly: build in a heavy stage, copy only the compiled artifact into a minimal final stage.

Answer

Build tools increase size and attack surface; multi-stage builds remove them.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice