Docker Image Naming#
Docker image names follow a structured format that encodes registry location, namespace, image name, and version. Understanding how Docker resolves omitted components is essential for working correctly with image references in commands, Dockerfiles, and CI pipelines.
Naming Format#
Every image reference conforms to this pattern :
[REGISTRY/][NAMESPACE/]NAME[:TAG|@DIGEST]
When components are omitted, Docker applies these defaults:
| Omitted component | Default value |
|---|---|
REGISTRY | registry.docker.com (Docker Hub) |
NAMESPACE | library |
TAG | latest |
DIGEST is a content-addressed SHA256 hash β a unique, immutable signature for an exact image version .
Default Registry: Docker Hub#
Docker Hub is the default registry . Images without an explicit registry prefix are resolved there automatically. Alternative registries β GitHub Container Registry (ghcr.io), Google Container Registry (gcr.io), etc. β require their hostname as a prefix .
Concrete Examples#
The course documentation provides three representative examples :
| Short reference | Fully-resolved equivalent |
|---|---|
ubuntu:22.04 | registry.docker.com/library/ubuntu:22.04 |
dduportal/docker-asciidoctor | registry.docker.com/dduportal/docker-asciidoctor:latest |
ghcr.io/dduportal/docker-asciidoctor:1.3.2@sha256:xxxx | (already fully qualified) |
The first example shows both the library namespace default and an explicit tag. The second shows the latest tag default applied to a user-namespaced image. The third demonstrates a non-default registry plus a digest pin.
The latest Tag Warning#
The latest tag is reassigned on remote registries over time β it is not a stable reference . The course materials consistently warn: "Friends don't let friends use latest" . Pin images to explicit version tags (e.g., ubuntu:22.04) or digests for reproducible builds.
Image Pull Mechanics#
Images can be retrieved explicitly or implicitly :
- Explicit pull β
docker image pull mysqldownloads the image without starting a container. - Implicit pull β
docker container run -d mysqlpulls the image automatically if absent, then starts a container.
The pull output confirms default resolution in action β running docker image pull mysql shows Using default tag: latest and Pulling from library/mysql .
Tagging Local Images#
Use docker image tag to assign additional names or version tags to a locally-built image :
docker image tag docker-git:latest docker-git:1.0.0
A single image (same content digest) can carry multiple tags simultaneously β both entries will appear in docker image ls but share the same IMAGE ID .
Primary Source#
All naming-convention content above originates from content/chapitres/images.adoc, specifically the "Conventions de nommage des images" sections (lines 542β626). The Docker Hub default-registry definition is in content/chapitres/docker-base.adoc.