Container Registry
A container registry is a service that stores, versions, and distributes container images. Developers and CI push images to it, and servers or clusters pull them to create containers.
What a registry does
A registry works like a package repository for images. You build once, push to the registry, and every host that needs the image pulls the same content. Registries store layers and manifests, organise them into repositories with tags, and handle authentication and access control.
Common registries
- Docker Hub: the default for unqualified names, with pull rate limits for anonymous and free accounts.
- GitHub Container Registry (ghcr.io): integrates with GitHub permissions and Actions.
- Amazon ECR: private registry with IAM-based access.
- Google Artifact Registry: the current Google Cloud service, replacing Container Registry (gcr.io).
- Azure Container Registry (ACR): the Azure equivalent.
- Harbor: open source and self-hosted, with scanning and replication.
Push and pull
docker login registry.example.comdocker tag payment-api:v3.1.0 registry.example.com/payment-api:v3.1.0docker push registry.example.com/payment-api:v3.1.0docker pull registry.example.com/payment-api:v3.1.0 # ECR uses short-lived tokensaws ecr get-login-password --region ap-south-1 | \ docker login --username AWS --password-stdin \ 123456789012.dkr.ecr.ap-south-1.amazonaws.comCleanup on ECR
aws ecr put-lifecycle-policy \ --repository-name payment-api \ --lifecycle-policy-text file://lifecycle-policy.json \ --region ap-south-1Troubleshooting
| Error | Cause | Fix |
|---|---|---|
pull access denied |
No login or permission | docker login |
manifest unknown |
Tag missing | Check tag spelling |
toomanyrequests |
Docker Hub rate limit | Authenticate or use a mirror |
| ECR auth expired | Token valid about 12 hours | Re-run login |
Common MistakeDeploying
:latest. Use immutable tags such as a version or git SHA.
SecurityKeep production images in private repositories and scan them. If a secret ever reaches a pushed image, rotate it, because deleting the image does not undo earlier pulls.
Frequently Asked Questions
Why run a private registry instead of using only Docker Hub?
Docker Hub enforces pull limits that can throttle busy CI, and public repositories expose your images. Private registries such as ECR, Artifact Registry, GHCR, or Harbor give access control, cloud IAM integration, and no shared rate limits.
What is a registry mirror or pull-through cache?
A mirror caches images from an upstream registry like Docker Hub inside your network. It reduces rate-limit failures, speeds pulls, and protects builds from upstream outages.
Why avoid the latest tag in deployments?
Latest is mutable, so a redeploy or a new node can pull different bytes than the running version. Immutable version tags or digests make deployments and rollbacks predictable.