Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Basics of Docker  ›  Lesson

Image Names and Tags

Basics of Docker 12 minA full image name is registry, namespace, repository and tag, and Docker fills in docker.io, library and latest for any part you leave out.

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:latest

Two commands help you see what you have:

docker pull postgres:16
docker images

docker 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?

Expanding bitnami/redisStep 1 of 4
  1. Registry

    No dot or colon before the first slash, so no registry is given. Fill in docker.io.

Drills

Answer fast — trust the rule.

quick drill

What does nginx expand to?

quick drill

In ghcr.io/acme/quicknotes:1.0, which part is the registry?

quick drill

Which statement about the latest tag is true?

quick drill

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, library and latest.
  • Shortcut: expand before you trust, left to right.
  • Trap: latest means "default", not "newest", and tags can move; digests cannot.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainExpand an image name

Expand the names postgres, bitnami/redis:7.2 and ghcr.io/acme/quicknotes:1.0 into their four parts, and explain why relying on the latest tag is risky.