Docker images can indeed be specified in two primary ways, depending on whether the registry domain is included. This is based on the Docker image naming conventions outlined in the official Docker documentation. Below, I'll explain the terminology, provide the two ways of specifying images, describe the part after the domain, and reference relevant official Docker documentation.
1. The Two Ways of Specifying Docker Images
Docker image specifications follow a structured format: [REGISTRY/]REPOSITORY[:TAG|@DIGEST]. The key difference lies in whether the registry (e.g., the domain name of the container registry) is explicitly included.
These terms are derived from Docker's image naming guidelines. The "short image name" is implied when no registry is present, while the "fully qualified image name" ensures clarity and avoids ambiguity, especially in environments with multiple registries.
2. What Do You Call the Part After the Domain?
When a registry domain is included (e.g., in a fully qualified image name like docker.io/library/nginx:latest), the part after the domain is called the repository or repository path.
-
Definition:
- The repository includes the namespace, image name, and any optional tag or digest. It essentially identifies the specific image within the registry.
- Example breakdown:
- In
docker.io/library/nginx:latest:
docker.io is the registry domain.
library/nginx:latest is the repository (or repository path).
library is the namespace (a way to organize images, often used for official images on Docker Hub).
nginx is the image name.
:latest is the tag.
- In
gcr.io/my-project/my-image:v1:
gcr.io is the registry domain.
my-project/my-image:v1 is the repository.
-
Official terminology: Docker documentation refers to this as the "repository" or "image repository." Specifically, it's described as the "path component" in the image name structure. The repository can include multiple path components (e.g., namespace and image name) and is separated from the registry by a slash.
References to Official Docker Documentation
Docker's official documentation provides detailed explanations of image naming and references. Here are the key sources:
-
Docker Engine Reference: Image Naming
- This page explains the structure of image names, including the optional registry prefix and the repository path.
- Reference: Docker Docs - Understand images and Docker Docs - Tag images.
- Quote from docs: "An image name is made up of slash-separated name components, optionally prefixed by a registry hostname."
-
Docker Hub Documentation: Repositories
- This covers how images are organized into repositories on Docker Hub, including namespaces and tags.
- Reference: Docker Hub - Repositories.
- Quote from docs: "A repository is a collection of Docker images with the same name but different tags."
-
Docker CLI Reference: Pull Command
- The
docker pull command documentation discusses how image names are interpreted, including short and fully qualified forms.
- Reference: Docker Docs - Docker Pull.
By following these conventions, you can ensure your Docker commands are precise and compatible across different environments. If you're working with custom registries, always use the fully qualified form to avoid defaults to Docker Hub. Let me know if you need more details or examples!