Best Container Registries: Docker Hub vs GHCR vs ECR Compared

Your container registry choice stops being boring the moment a deploy stalls at 3 AM because Docker Hub rate-limited your image pulls, or an AWS bill shows a data-transfer line you never budgeted for. This guide compares Docker Hub, GitHub Container Registry (GHCR), and Amazon Elastic Container Registry (ECR) on pricing, pull limits, security, and CI/CD integration.

The short version: AWS workloads, use ECR. Code and CI on GitHub, GHCR. Public images, Docker Hub. Here is why.

What a container registry does

A container registry stores the image layers your infrastructure pulls at runtime. Your CI builds an image and pushes it; your cluster, server, or Fargate task pulls it back to deploy. What matters in production: pull rate limits, how far images travel across regions, how access is authenticated, and whether old images get cleaned up automatically. All three registries below are OCI-compliant, so the same docker pull and docker push commands work everywhere. Whether the pull destination is one host running Compose or a full cluster is its own decision, and our Docker Compose vs Kubernetes comparison walks through it.

Docker Hub: the default public registry

Docker Hub is where almost every public image starts. Official images for Nginx, Postgres, Redis, and your base runtimes live here, and most Docker tutorials assume docker pull resolves against it. That ubiquity is its biggest strength: public repositories are unlimited on the free tier, and the ecosystem of documented images is unmatched.

The pain point is the pull rate limit. Anonymous pulls are capped at 100 per 6-hour window per IP, and authenticated free accounts get 200 pulls per 6-hour window. That limit hits fast when a Kubernetes cluster sits behind one NAT gateway, or CI runners share IPs with thousands of other users, and then deploys fail. Free accounts also get just one private repository; beyond that you need a paid plan. Docker Hub Pro runs around $7 per month and Team around $15 per user per month, both with higher limits and more private repos.

Docker Scout provides scanning and SBOM generation, but the useful parts sit behind paid tiers. Docker Hub also stores images in a single US region, so pulls to servers in Europe or Asia always cross an ocean. Docker Hub fits open-source distribution and public images best. For private production images, it is workable only if you pay.

GitHub Container Registry (GHCR): the GitHub-native option

GHCR is the registry you already have if your code is on GitHub. It lives at ghcr.io, image visibility follows repo visibility, and Actions workflows authenticate with the same GITHUB_TOKEN they already use. No separate credential to rotate, no second billing account. Permissions are repo-scoped with fine-grained tokens.

Public packages are free to store and pull, with no documented anonymous pull rate limit like Docker Hub’s. Private images use the 500 MB in GitHub’s free plan; beyond that you pay GitHub Packages rates of around $0.25 per GB of storage and $0.50 per GB of outbound transfer. Transfer to Actions runners on the same plan is free, so teams that build and deploy inside Actions rarely pay much.

GHCR has two real trade-offs. First, it has no built-in vulnerability scanning at the registry layer, so you compose that with Dependabot, CodeQL, or a third-party scanner in your pipeline. Second, GitHub publishes no registry region map, so cross-region pull performance varies and can be noticeably slower than a regionally replicated alternative. GHCR fits GitHub-native teams and open-source maintainers who want their registry’s auth model to match their source control.

Amazon ECR: the AWS-native option

ECR is the private-by-default registry for AWS workloads. It plugs into EKS, ECS, and Fargate with IAM-based access, so an instance or task role pulls images without long-lived credentials. Scanning is built in: basic scanning is free, enhanced Inspector scanning is billed per image. Lifecycle policies delete old or untagged images automatically, and cross-region replication copies images to other regions.

The pricing model is pure usage: around $0.10 per GB per month of private storage. New accounts get 500 MB of private storage free for the first 12 months. Data transfer is the line that surprises people. Pulls to EC2, ECS, EKS, or Fargate in the same region cost nothing, and the first 100 GB per month of internet egress is free account-wide; after that, internet transfer runs around $0.09 per GB on a tiered schedule. For the common pattern of CI pushing to ECR and Fargate pulling in the same region, the only bill line is storage, which grows from old images nobody deletes. A lifecycle policy that expires untagged images after a day and dev images after 30 days keeps that near zero.

Two less obvious charges: pulling through a NAT gateway adds about $0.045 per GB in processing fees (VPC endpoints avoid this), and KMS encryption adds API-call charges unless you use the default AES-256. Prices here are approximate, so check the official ECR pricing page before budgeting.

Docker Hub vs GHCR vs ECR: side by side

Docker Hub GHCR Amazon ECR
Best for Public images, open-source distribution GitHub-native teams, Actions CI/CD AWS workloads (EKS, ECS, Fargate)
Private repos 1 free, unlimited paid 500 MB free plan, then billed per GB Private by default, billed per GB
Storage pricing Included in plan tiers ~$0.25/GB-month beyond free quota ~$0.10/GB-month
Pull limits 100/6h anonymous, 200/6h free authenticated None documented like Docker Hub’s None
Image scanning Docker Scout (paid tiers) None built in; use Dependabot or third-party Built in; basic free, Inspector enhanced paid
CI/CD integration Generic GitHub Actions, GITHUB_TOKEN auth AWS CodePipeline, IAM roles
Region control US only No published region map Per-region repos, cross-region replication
Image cleanup Manual tag deletion Retention policies Lifecycle policies

Which container registry should you choose?

  • Your workloads run on AWS. Use ECR. Same-region pulls are free, IAM removes credential juggling, and lifecycle policies handle cleanup.
  • Your code and CI live on GitHub. Use GHCR. Authentication, permissions, and billing all ride on the GitHub account your team already has, and public images are free.
  • You distribute public images or depend on official base images. Keep Docker Hub for that. No alternative matches its catalog. Mirror the base images you pull most often into your private registry so Docker Hub’s rate limit never touches your deploys.
  • You run multi-cloud or on your own servers. GHCR is the cheapest neutral option for most teams, since ECR’s free same-region transfers only help inside AWS. Many teams end up with two registries: Docker Hub for public distribution, one private registry for their own images.

Practical tips whatever you pick

  • Set up image cleanup on day one. Every CI run orphans an untagged image. ECR lifecycle policies, GHCR retention policies, or a scheduled cleanup job all work; the specific tool matters less than having one.
  • Pin production deploys to image digests, not tags. Pull nginx@sha256:... instead of nginx:latest so a rollback always references the exact layers that ran before.
  • Mirror public base images into your own registry. One weekly job copying your top base images removes Docker Hub rate limits from your critical path entirely.
  • Re-check pricing yearly. Registry pricing has changed repeatedly in recent years. A choice that was cheap when you made it can quietly become the expensive one.

Frequently asked questions

Is GHCR free?

Public packages are free to store and pull. Private images use the 500 MB storage included in GitHub’s free plan, and usage beyond the included quotas bills against GitHub Packages rates. Check GitHub’s official pricing page for current numbers.

Does Amazon ECR have pull rate limits?

No documented pull rate limits. ECR charges for storage and data transfer instead of throttling pulls, which is why it is popular for high-volume CI/CD pipelines on AWS.

Can I move images from Docker Hub to ECR or GHCR?

Yes, and it takes three commands per image: docker pull the image, docker tag it with the new registry address, then docker push it. The registry CLI examples differ slightly, but the workflow is identical everywhere.

Which is the cheapest registry for private images?

It depends on volume and where your traffic flows. Small GitHub teams fit inside GHCR’s free quotas. AWS-heavy teams pay only ECR storage since same-region pulls are free. Light users can manage with Docker Hub’s single free private repo. All prices here are approximate; confirm on the official pricing pages.

What should open-source projects use?

Docker Hub if you want maximum distribution, since that is where developers look first. GHCR if your project already lives on GitHub, since public packages are free and publishing fits naturally into your Actions workflow.

Pick the registry closest to where your code and workloads already live, mirror your public base images so rate limits never bite you, and set up cleanup policies before storage costs creep. Smaller images stretch those quotas further, which is why multi-stage Dockerfiles that shrink image size pair so well with a tidy registry.

Ditulis oleh

Firdaus Safari Putra

Founder, PT FirKaizen Digital Solutions

Firdaus Safari Putra adalah founder PT FirKaizen Digital Solutions. Ia membangun dan mengoperasikan infrastruktur server di balik panduan ini, dan menulis berdasarkan apa yang benar-benar ia jalankan, uji, dan ukur — bukan teori.