28 s loop7 sentencesSilent, read alongScene: LayersRead the story, sentence by sentence 7 sentences
What you'll be able to say
- Each Dockerfile instruction adds a layer to the image, and layers stack on top of the ones before them.
- Docker’s build cache reuses a layer when its instruction and copied files are unchanged; a change invalidates that layer and all later ones.
- Copy package.json and run npm install before copying your source code, so code edits reuse the cached dependency layer.