Docker Concepts
Multi-stage build
Multiple FROM stages separate preparation and delivery. Copy needed outputs into a fresh base; intermediate artifacts can remain in builder cache. A stage may inherit an earlier named stage; fresh bases are not automatic.
Formal Syntax & Structure
docker syntaxdocker
Multi-stage buildWorking Example
Example Snippetdocker
FROM busybox:1.37 AS prepareWORKDIR /workCOPY notes.txt .RUN tr a-z A-Z < notes.txt > report.txtFROM busybox:1.37 AS runtimeCOPY --from=prepare /work/report.txt /report.txtCMD ["cat", "/report.txt"]