Docker reads the Dockerfile top-down, each instruction creates a layer, cache is reused when inputs match, final image is the union.
graph LR DF[Dockerfile] --> F[FROM base] F --> R[RUN install] R --> C[COPY source] C --> B[Build stage] B --> M[Multi-stage copy] M --> IMG[Final image] style IMG fill:#E8F5E9