Bird
Raised Fist0
Dockerdevops~10 mins

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

Choose your learning style10 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.

Practice

(1/5)
1. Which part of the Docker image name docker.io/library/nginx:latest specifies the version of the image?
easy
A. latest
B. docker.io
C. nginx
D. library

Solution

  1. Step 1: Identify the tag in the image name

    The tag is the part after the colon (:), which specifies the version or variant of the image.
  2. Step 2: Locate the tag in the example

    In docker.io/library/nginx:latest, the tag is latest.
  3. Final Answer:

    latest -> Option A
  4. Quick Check:

    Tag = latest [OK]
Hint: Tag is always after colon ':' in image name [OK]
Common Mistakes:
  • Confusing registry with tag
  • Thinking image name is the tag
  • Ignoring the colon separator
2. Which of the following is the correct syntax for a Docker image name with a registry, image, and tag?
easy
A. tag/image:registry
B. registry/image:tag
C. image:tag/registry
D. image/registry:tag

Solution

  1. Step 1: Recall the Docker image naming format

    The correct format is registry/image:tag, where registry is optional but comes first, then image name, then tag after colon.
  2. Step 2: Match the options to the format

    Only registry/image:tag matches the correct order and separators.
  3. Final Answer:

    registry/image:tag -> Option B
  4. Quick Check:

    Format = registry/image:tag [OK]
Hint: Registry first, then image, then tag after ':' [OK]
Common Mistakes:
  • Placing tag before image
  • Swapping registry and image order
  • Using wrong separators like '/' for tag
3. What is the full image name including registry and tag for the official Redis image version 7.0 from Docker Hub?
medium
A. docker.io/redis7:0
B. redis:7.0
C. redis/docker.io:7.0
D. docker.io/redis:7.0

Solution

  1. Step 1: Understand Docker Hub default registry

    Docker Hub's registry is docker.io. The official images are under this registry.
  2. Step 2: Compose full image name

    The full name includes registry, image name, and tag: docker.io/redis:7.0.
  3. Final Answer:

    docker.io/redis:7.0 -> Option D
  4. Quick Check:

    Full name = docker.io/redis:7.0 [OK]
Hint: Full name = registry/image:tag, Docker Hub registry is docker.io [OK]
Common Mistakes:
  • Putting registry after image
  • Missing registry for full name
  • Incorrect tag format
4. You try to pull the image myregistry.com/myapp but get an error. Which of these is a likely cause?
medium
A. Missing tag defaults to 'latest', but image may not have it
B. Registry name cannot contain dots '.'
C. Image name must always include a tag
D. Registry must be 'docker.io' only

Solution

  1. Step 1: Understand default tag behavior

    If no tag is given, Docker uses latest by default. If the image does not have a 'latest' tag, pull fails.
  2. Step 2: Check other options for errors

    Registry names can contain dots, tags are optional, and registries can be other than docker.io.
  3. Final Answer:

    Missing tag defaults to 'latest', but image may not have it -> Option A
  4. Quick Check:

    Default tag 'latest' may be missing [OK]
Hint: No tag means 'latest' assumed, may cause pull failure [OK]
Common Mistakes:
  • Thinking registry can't have dots
  • Believing tag is mandatory
  • Assuming only docker.io registry works
5. You want to tag a local image myapp to push it to a private registry at registry.example.com with version v2. Which command correctly tags the image?
hard
A. docker tag myapp:v2 registry.example.com/myapp
B. docker tag registry.example.com/myapp:v2 myapp
C. docker tag myapp registry.example.com/myapp:v2
D. docker tag myapp registry.example.com:v2/myapp

Solution

  1. Step 1: Understand docker tag syntax

    The syntax is docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG].
  2. Step 2: Apply to given names

    Source is myapp (local), target is registry.example.com/myapp:v2 to specify registry and tag.
  3. Final Answer:

    docker tag myapp registry.example.com/myapp:v2 -> Option C
  4. Quick Check:

    Tag command: source then target with registry and tag [OK]
Hint: Tag command: source image then target with registry:tag [OK]
Common Mistakes:
  • Swapping source and target images
  • Placing tag in wrong position
  • Using invalid registry/tag format
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard