What Is a Docker Registry?
Learn what a Docker registry is, how repositories and tags organize images, how layer-based pulls work, and public vs private registry options.
Expected Interview Answer
A Docker registry is a storage and distribution service for container images, holding tagged versions that can be pushed to it and pulled from it by name, such as Docker Hub, GitHub Container Registry, or a private registry.
A registry organizes images into repositories, each holding multiple tags that represent different versions or builds of the same image. When you run `docker pull`, Docker contacts the registry, checks which layers you already have cached locally, and downloads only the missing ones, which makes repeated pulls fast. Registries can be public, like Docker Hub, or private and self-hosted, letting teams control access, scan images for vulnerabilities, and enforce which versions are approved for deployment.
- Central place to publish and version container images
- Only missing layers are downloaded, saving bandwidth
- Supports both public and private, access-controlled hosting
- Enables consistent deployment across teams and environments
- Integrates with CI/CD pipelines for automated builds
AI Mentor Explanation
A Docker registry is like a national cricket board's official kit store where every franchise uploads its verified team jerseys by season and squad name, so any club can order the exact jersey version they need. When a new order comes in, only the changed badge or sponsor patch is reprinted rather than the whole jersey. Some boards keep a private store just for their own academy sides.
Step-by-Step Explanation
Step 1
Tag the image
An image is tagged with a repository name and version, such as myapp:1.2.0, before it can be pushed.
Step 2
Authenticate to the registry
Docker logs in with credentials or a token so the registry can enforce access control.
Step 3
Push layers
docker push uploads only the image layers the registry does not already have, saving bandwidth.
Step 4
Store and index
The registry stores layers as content-addressable blobs and indexes them under the repository and tag.
Step 5
Pull on demand
docker pull fetches the manifest, then downloads only the layers missing from the local cache.
What Interviewer Expects
- Explains repositories, tags, and how they relate to a single image
- Understands that only missing layers transfer on push or pull
- Can name public options like Docker Hub and private/self-hosted alternatives
- Knows registries support authentication and access control
- Mentions vulnerability scanning or CI/CD integration as real-world use cases
Common Mistakes
- Confusing a registry with a single repository or a single image
- Assuming every pull re-downloads the entire image from scratch
- Believing Docker Hub is the only registry option available
- Forgetting that private registries require explicit authentication
Best Answer (HR Friendly)
“A Docker registry is like an online storage service for application images, similar to an app store but for backend software. Teams upload their finished application versions there, and any server can download the exact version it needs, which keeps deployments consistent and organized.”
Code Example
# Build and tag for a private registry
docker build -t registry.example.com/team/myapp:1.2.0 .
# Log in and push
docker login registry.example.com
docker push registry.example.com/team/myapp:1.2.0
# On another host, pull the exact same version
docker pull registry.example.com/team/myapp:1.2.0Follow-up Questions
- What is the difference between a registry, a repository, and an image?
- How does Docker decide which layers to download during a pull?
- What are some alternatives to Docker Hub for hosting images?
- How do private registries handle authentication and access control?
- Why would a company run its own self-hosted registry?
MCQ Practice
1. What does a Docker registry store?
A registry stores container images, organized into repositories with tags representing versions.
2. What happens when you pull an image you already partially have cached?
Docker checks the local layer cache and only downloads layers that are missing, saving bandwidth and time.
3. Which of these is an example of a container registry?
Docker Hub is a public container registry; the others are package registries for other ecosystems.
Flash Cards
What is a Docker registry? — A service that stores and distributes tagged container images.
What is the relationship between a registry, repository, and tag? — A registry hosts repositories; each repository holds multiple tagged image versions.
Why are pulls fast after the first one? — Docker only downloads layers not already present in the local cache.
Name a public and a private registry option. — Docker Hub (public) and a self-hosted registry like Harbor (private).