Container Registries
Store, version, secure and distribute images through public and private registries.
Intermediate · about 3 hours · difficulty 2/5
Learn first: Building Good Images
A registry stores images so CI can push them and servers or clusters can pull them. Choosing and configuring it well affects security, cost and deploy reliability.
Options
- Public: Docker Hub (note pull rate limits for anonymous users), GitHub Container Registry (
ghcr.io), Quay. - Cloud: Amazon ECR, Google Artifact Registry, Azure Container Registry. These integrate with cloud IAM so nodes pull without static passwords.
- Self-hosted: Harbor (adds scanning, replication, RBAC) or the plain
registryimage.
Concepts
- Image reference:
registry/namespace/repo:tag@sha256:digest. Tags are mutable pointers; digests are immutable. - Immutable tags setting prevents overwriting a released version.
- Lifecycle policies delete untagged or old images to control storage cost.
- Pull-through caches and mirrors avoid external rate limits and outages.
- Scanning on push and signed images (covered later in supply chain security).
Pitfalls
Pulling from Docker Hub in every CI job and hitting rate limits, long-lived registry passwords stored in CI, and deploying by mutable tag so two nodes end up running different code.
Good enough to move on: you can push an image from CI to a private registry using short-lived credentials, reference it by digest, and set a lifecycle policy.
Key concepts
- Docker Hub and rate limits
- Cloud registries (ECR, GAR, ACR)
- GitHub Container Registry
- Tags vs digests
- Immutable tags and lifecycle policies
- Harbor self-hosted
- Pull-through caches
Mini project
Create a private repository in ECR or GHCR, push an image tagged with the git SHA, pull it on another machine by digest, and configure a policy that removes untagged images after 7 days.
Check yourself
Why does deploying by digest give stronger guarantees than deploying by tag?
Free resources
- Amazon ECR docs (AWS)
- Working with the Container registry (GitHub)