Card 06/ 06

RecapDifficulty: Intermediate1 min

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.

What the topic established, and which card it was on
The ideaWhere
A Dockerfile is read top to bottom, each instruction changing what the one above it leftDockerfiles: The Recipe for an Image
RUN happens at build time, CMD every time a container startsDockerfile Instructions: FROM, WORKDIR, COPY, RUN and CMD
docker build -t name:tag . names the result; the . is the context COPY reads fromBuilding an Image With docker build and Running It
A tag is a movable label on an image id, not a versionImage Tags: A Movable Name, Not a Version
latest is only the default tag, which is why it is worth naming a real oneThe 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.