Suggest an editImprove this articleRefine the answer for “How is an image built from a Dockerfile?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)An image is built from a Dockerfile with the **`docker build`** command, where Docker reads the file line by line and, at each step, forms a new layer of the future image. **Key point:** Docker builds an image by executing the Dockerfile instructions step by step during `docker build`, forming a layered template of a container ready to run.Shown above the full answer for quick recall.Answer (EN)ImageAn image is built from a Dockerfile with the `docker build` command, where Docker reads the file line by line and, at each step, forms a new layer of the future image. ### **The process, junior-style** 1. **You write a Dockerfile** - a set of instructions (`FROM`, `COPY`, `RUN`, `CMD`, and so on). 2. **You run the image build:** ```bash docker build -t myimage . ``` 3. **Docker reads the Dockerfile top to bottom** and: - takes the base image (`FROM`) - copies files (`COPY`) - runs commands (`RUN`) - sets up the environment 4. **Each instruction becomes a layer** of the future image. 5. **After executing all the instructions, Docker saves the image** under the given name and tag (`myimage`). ### **What is important to understand** - Docker caches layers - if a line has not changed, the layer is not rebuilt. - The build result is an **image**, which you can view with: ```bash docker images ``` ### **Summary** > Docker builds an image by executing the Dockerfile instructions step by step during `docker build`, forming a layered template of a container ready to run.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.