Docker
Container Registry
Naming Conventions
Best Practices
Docker Security

Naming to docker.io: how Docker image names resolve and how to avoid surprises

Codemia Knowledge Hub ·

A Docker image name has a registry, a repository and an optional tag. When you leave out the registry, Docker assumes docker.io (Docker Hub), and for single-word names it also assumes the library namespace. So ubuntu:latest really means docker.io/library/ubuntu:latest. Writing the full registry path avoids pulling from a registry you did not intend.

The parts of an image name

  1. Registry: where the image is stored.
  2. Repository: the name of the user's or organization's image repository.
  3. Tag: an optional identifier that distinguishes image versions.

In docker.io/library/ubuntu:latest, docker.io is the registry, library/ubuntu is the repository, and latest is the tag.

The implicit docker.io default

Docker's defaults hide the registry. Running docker pull ubuntu:latest fetches docker.io/library/ubuntu:latest. This implicit behavior can make names ambiguous, which is why it helps to know the default rules.

How a name is resolved

  1. When you run docker pull ubuntu:latest:
    • Docker resolves the image from the default registry, docker.io.
    • It looks in the library namespace, a legacy convention.
  2. To use a different registry, give the full path, for example docker pull myregistry.example.com/myrepo/ubuntu:latest.

Ambiguity between machines

Suppose two users set up their systems differently:

  • User A runs docker pull customrepo/myapp.
  • User B runs docker pull myapp.

Both mean to fetch the same image, but if User A's custom repository is not mirrored for User B, they can end up with different versions or even different software.

Risks of implicit names

  • Security: pulling from the wrong or an unintended repository can mean running malicious code.
  • Deployment consistency: without explicit image details, environments can run different software versions without anyone noticing.

Connectivity problems and deployment delays also happen when an image is accidentally pulled from the default docker.io registry instead of an enterprise or private one.

Preventing naming problems

  1. Explicit naming: always specify the full registry path to avoid ambiguity.
  2. Pin the version: use a specific tag such as docker.io/library/ubuntu:24.04 instead of latest, or a digest (ubuntu@sha256:<digest>) when every machine must get the exact same image.
  3. Control where Hub pulls go: in an enterprise setup, push images to your private registry and reference them by that registry's name, or set registry-mirrors in /etc/docker/daemon.json so Docker Hub pulls go through your mirror. Mirrors apply only to Docker Hub images.

Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design