Suggest an editImprove this articleRefine the answer for “What is a layer in a Dockerfile?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)A **layer** in a Dockerfile is the result of executing **one instruction** in the Dockerfile. **Key point:** a layer is the immutable result of one Dockerfile instruction, which Docker caches and reuses when building.Shown above the full answer for quick recall.Answer (EN)ImageA layer in a Dockerfile is the result of executing **one instruction** in the Dockerfile. Each command (`FROM`, `RUN`, `COPY`, `ADD`, and so on) creates a new layer in the image. ### **How to understand this at the junior level** - An image is built **in layers, like a cake** -> each step adds a layer. - Layers are **cached** -> if a layer has not changed, Docker does not rebuild it and takes it from the cache. This speeds up the build. - Layers are **immutable** -> if something needs to change, Docker just creates a new layer on top, without changing the lower ones. ### **Example** ```Dockerfile FROM ubuntu:22.04 # layer 1 RUN apt-get update # layer 2 COPY . /app # layer 3 RUN make build # layer 4 ``` As a result, the image consists of 4 layers. ### **Summary in one phrase** > A layer is the immutable result of one Dockerfile instruction, which Docker caches and reuses when building.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.