Card 06/ 06
Recap: Building an Image
The Dockerfile, its instructions, docker build, and the two facts about tags, with where each was.
Building an image comes down to the five ideas below, each listed with the card that covers it.
| The idea | Where |
|---|---|
| A Dockerfile is read top to bottom, each instruction changing what the one above it left | Dockerfiles: The Recipe for an Image |
RUN happens at build time, CMD every time a container starts | Dockerfile Instructions: FROM, WORKDIR, COPY, RUN and CMD |
docker build -t name:tag . names the result; the . is the context COPY reads from | Building an Image With docker build and Running It |
| A tag is a movable label on an image id, not a version | Image Tags: A Movable Name, Not a Version |
latest is only the default tag, which is why it is worth naming a real one | The latest Tag Is Not the Newest Image |
Together they give a working habit: build with a real tag, run by that tag, and treat latest as a convenience rather than a fact about the image.
← → move through sections and cards