Registries & Docker Hub
A registry is a service that stores and distributes Docker images; Docker Hub is the default public one.
A registry is a server that stores Docker images so they can be shared and pulled. It is to images what GitHub is to code.
Docker Hub
Docker Hub is the default public registry. When you run docker pull nginx, Docker fetches the image from Docker Hub. It hosts official images (maintained by Docker or the software's authors) and community images.
Other registries
- GitHub Container Registry —
ghcr.io. - Amazon ECR, Google Artifact Registry, Azure Container Registry — cloud provider registries.
- Self-hosted — run your own private registry.
Example
# Search Docker Hub from the command line
docker search postgres
# Pull an official image (from Docker Hub by default)
docker pull nginx:1.27-alpine
# Pull from a different registry by including its host
docker pull ghcr.io/acme/api:2.1When to use it
- A developer pulls the official postgres:16-alpine image from Docker Hub instead of building a database image from scratch.
- A company hosts a private registry on AWS ECR so CI/CD pipelines push proprietary application images without exposing them publicly.
- A team mirrors frequently used public images to an internal registry to avoid Docker Hub rate limits during large-scale CI runs.
More examples
Search Docker Hub for an image
Searches Docker Hub for Nginx images and then pulls the lightweight Alpine variant.
docker search nginx --limit 5
docker pull nginx:alpineLog in to Docker Hub
Authenticates to Docker Hub; using --password-stdin avoids the password appearing in shell history.
docker login
# Or with flags for scripted use:
docker login -u myusername --password-stdin <<< "$DOCKER_PAT"Show image full registry path
Shows that Docker Hub pull shorthand expands to docker.io/library/<image> internally.
# Short form (Docker Hub implied)
docker pull nginx:alpine
# Equivalent full form
docker pull docker.io/library/nginx:alpine
Discussion