Image Names and Tags
You type docker pull postgres and something downloads. From where? Which version? A teammate's laptop pulled the "same" image last month and got a different one. Every image name hides several parts, and Docker quietly fills in the ones you leave out.
The rule
Where / who / what : which version — and Docker fills the blanks.
A full image reference has four parts:
ghcr.io / acme / quicknotes : 1.0
registry namespace repository tag- Registry: the server that stores the image. If you leave it out, Docker uses Docker Hub,
docker.io. - Namespace: the account or organisation that owns it. On Docker Hub, official images live under
library, which you never type. - Repository: the image's name.
- Tag: a label for one version. If you leave it out, Docker uses
latest.
So these pairs are identical:
docker pull postgres
docker pull docker.io/library/postgres:latestTwo commands help you see what you have:
docker pull postgres:16
docker imagesdocker images lists each local image with its repository, tag, ID and size.
Two warnings about tags. First, latest is only a default name, not a promise of "newest"; its owner can point it at a different image at any time. Second, even a tag like 16 moves as patch releases come out. For exact repeatability you can pin a digest, the content hash of one precise image: postgres@sha256:….
The shortcut
Expand before you trust. Whenever you read a short name, mentally fill in the missing parts, left to right: registry? namespace? tag?
Registry
No dot or colon before the first slash, so no registry is given. Fill in
docker.io.
Drills
Answer fast — trust the rule.
What does nginx expand to?
In ghcr.io/acme/quicknotes:1.0, which part is the registry?
Which statement about the latest tag is true?
You need every server to run exactly the same bytes of an image, forever. What should you reference?
Remember
- A full name is registry / namespace / repository : tag; Docker fills in
docker.io,libraryandlatest. - Shortcut: expand before you trust, left to right.
- Trap:
latestmeans "default", not "newest", and tags can move; digests cannot.
