Skip to content
$ lynuxpro
← All system designs

MID · 11 MIN · DEVOPS · PLATFORM

Container and artifact registry

Content-addressed blobs in object storage, a metadata database, pull-through caches, CVE rescans and replication to other regions.

Peak load
~1 GB/s pulls in a scale-up
Availability target
99.95%
RTO: back up within
30 min
RPO: data you can lose
15 min

← Swipe sideways to see the whole diagram →

ClientEdge / networkServiceData storeSecurityInfrastructureasync / background

The question

"Design an internal registry for Docker images and packages (Maven, npm, PyPI) used by every CI pipeline and every Kubernetes node."

Requirements

  • Push and pull OCI images and common package formats.
  • Pulls must be fast and highly available: if the registry is down, nothing can deploy or scale.
  • Cache public registries (Docker Hub has rate limits) and block known-bad packages.
  • Keep costs down with cleanup rules.

How it works

  1. CI pushes images; nodes pull them through a load balancer to stateless registry API servers.
  2. Image layers are stored in object storage by their SHA-256 digest (content-addressed), so identical layers are stored once.
  3. A metadata database (Postgres) holds repositories, tags, permissions and quotas.
  4. For public images and packages, the registry acts as a pull-through cache: first pull fetches from upstream, later pulls are local.
  5. A scanner checks new images and rescans old ones when new CVEs appear.
  6. Blobs replicate to another region, and each region serves its own nodes.

Remember it: tags move, digests don't. Deploy by digest (image@sha256:...) for repeatable releases.

Key decisions

DecisionChoiceWhy
StorageS3 / GCS behind the APIdurable, cheap, scales without disks
ProductHarbor, Artifactory, ECRbuild vs buy: buying is usually right
Cleanupkeep last N tags, delete untagged after 7 daysstorage grows fast otherwise
Rolloutnode-local caches / image pre-pullingfaster scale-ups and fewer registry calls

What breaks and how it heals

  • Registry down: already-running pods keep running; new pods fail with ImagePullBackOff. Run several replicas across zones and a replica region.
  • Upstream outage (Docker Hub down): cached images keep working.
  • Huge images slow scale-ups: smaller base images, lazy-loading image formats, pre-pulling on new nodes.

Load and capacity

ItemAssumptionResult
Fleet5,000 nodessteady pulls are small; spikes come from scale-ups
Big scale-up200 new nodes each pull a 500 MB image in 2 minutes100 GB in 2 min ≈ ~0.8 GB/s from storage
Storage50 TB today, +2 TB per monthcleanup rules typically remove 40-60%
Pushes3,000 pipelines a day~2 per minute on average

High availability and disaster recovery

TargetNumberHow it is met
Availability99.95% (every deploy and scale-up needs it)3+ API replicas across AZs, Postgres Multi-AZ, blobs in S3
A zone failsno impactreplicas in the other zones keep serving
Region failsRTO 30 min, RPO 15 minblobs copied to a second region (cross-region replication, minutes behind) plus a database replica
Upstream registry outageno impact for cached imagespull-through cache keeps every image used before

What interviewers listen for

  • Content addressing and why it saves storage and makes deploys reproducible.
  • Availability thinking: the registry is on the critical path for every deploy.
  • Caching upstream, scanning and retention policies.