Docker Registry: A Library for Your Images
A Docker Registry is like GitHub, but for Docker images. It's a centralized storage system where you push and pull images, enabling sharing and deployment. The biggest footgun is using the `:latest` tag, which can lead to unpredictable builds.
WHY IT EXISTS: Docker packages applications into portable images. To make these images useful, you need a way to store, manage, and share them. Without a registry, you'd be manually copying large image files between machines, which is slow, error-prone, and doesn't scale.
THE MENTAL MODEL: Think of a Docker Registry as a library or an artifact repository, like GitHub for code or Maven Central for Java libraries. It's a server-side application that stores your Docker images, organized into repositories, and makes them available over a network. Docker Hub is a massive public registry, but you can also run your own private one.
HOW IT WORKS: You interact with a registry using the Docker CLI. The docker push <image_name> command uploads an image's layers to the registry. The docker pull <image_name> command downloads them. Each image is stored in a repository and identified by a name and a tag, like nginx:1.21.6. The registry handles storing the image layers efficiently, so shared layers are only stored once.
WHEN TO USE IT: Use a registry whenever you need to move a Docker image from one machine to another. This is fundamental for most Docker workflows, including deploying applications to servers, running builds in a CI/CD pipeline, or sharing a development environment with teammates.
WHEN NOT TO USE IT: For purely local development on a single machine where you build and run an image without ever needing to share it, you don't technically interact with a remote registry. However, even docker build often starts by pulling a base image from a registry, so it's rare to avoid them entirely.
ONE CANONICAL EXAMPLE: A developer builds a new version of their web application using a Dockerfile. They tag the resulting image as my-app:v1.2.0 and run docker push my-registry/my-app:v1.2.0. The CI/CD server, notified of the new push, then runs docker pull my-registry/my-app:v1.2.0 on the production servers and restarts the containers to deploy the new version. This workflow relies on the registry as the central source of truth for the application image.
Read the original → docs.docker.com
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.