0
0
Dockerdevops~10 mins

Image naming conventions (registry/image:tag) in Docker - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Image naming conventions (registry/image:tag)
Start with registry (optional)
Add image name (required)
Add tag (optional, default 'latest')
Full image name formed
Use image in docker commands
Docker image names can include an optional registry, a required image name, and an optional tag. The tag defaults to 'latest' if omitted.
Execution Sample
Docker
docker pull ubuntu:20.04

docker pull myregistry.com/myapp:1.2

docker pull nginx
These commands pull images using different naming conventions: with tag, with registry and tag, and with default tag.
Process Table
StepImage Name InputRegistry ParsedImage ParsedTag ParsedFinal Image Reference
1ubuntu:20.04docker.io (default)ubuntu20.04docker.io/library/ubuntu:20.04
2myregistry.com/myapp:1.2myregistry.commyapp1.2myregistry.com/myapp:1.2
3nginxdocker.io (default)nginxlatest (default)docker.io/library/nginx:latest
4exit---All images parsed and ready for use
💡 No more image names to parse; process ends.
Status Tracker
VariableStartAfter 1After 2After 3Final
registrynonedocker.iomyregistry.comdocker.iovaries per input
imagenoneubuntumyappnginxvaries per input
tagnone20.041.2latestvaries per input
Key Moments - 2 Insights
Why does 'nginx' get 'docker.io' as the registry and 'latest' as the tag?
When no registry is specified, Docker assumes the default 'docker.io'. When no tag is given, Docker uses 'latest' by default, as shown in execution_table row 3.
How does Docker know where the registry ends and the image name begins?
Docker treats the first part before the first slash as the registry if it contains a dot or colon (like 'myregistry.com'). Otherwise, it assumes the default registry. This is shown in execution_table rows 1 and 2.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the tag parsed for the image 'ubuntu:20.04'?
A20.04
Blatest
Cubuntu
Ddocker.io
💡 Hint
Check the 'Tag Parsed' column in row 1 of the execution_table.
At which step does Docker use the default registry 'docker.io'?
AStep 1 only
BStep 2 only
CSteps 1 and 3
DAll steps
💡 Hint
Look at the 'Registry Parsed' column in the execution_table rows 1 and 3.
If the image name is 'myregistry.com/myapp' without a tag, what would the tag be?
Amyapp
Blatest
Cnone
D1.0
💡 Hint
Tags default to 'latest' if omitted, as shown in the explanation and execution_table.
Concept Snapshot
Docker image names can include an optional registry, a required image name, and an optional tag.
Format: [registry/]<image_name>[:tag]
If registry is missing, 'docker.io' is assumed.
If tag is missing, 'latest' is assumed.
Examples: 'ubuntu:20.04', 'myregistry.com/myapp:1.2', 'nginx'
Use full image names in docker commands for clarity.
Full Transcript
Docker images are named using a pattern that can include a registry, an image name, and a tag. The registry is where the image is stored, like a website address. If you don't write a registry, Docker assumes the default one called 'docker.io'. The image name is required and tells Docker which image to use. The tag is optional and tells Docker which version of the image to use. If you don't write a tag, Docker uses 'latest' by default. For example, 'ubuntu:20.04' means the 'ubuntu' image with the '20.04' tag from the default registry. 'myregistry.com/myapp:1.2' means the 'myapp' image with tag '1.2' from 'myregistry.com'. 'nginx' means the 'nginx' image with the 'latest' tag from the default registry. Understanding this helps you pull and run the right images in Docker.