Amazon ECR
Fully managed Docker container registry
ECR is like a secure warehouse for your Docker images. When you build Docker images, you need to store them somewhere before deploying to ECS, EKS, or other container platforms. ECR is a private Docker registry: you push images to ECR, and your container services pull them when deploying. It's integrated with IAM for access control, encrypted at rest, and scans images for vulnerabilities. Think of it as Docker Hub, but private, secure, and deeply integrated with AWS services.
ECR stores Docker images in repositories (one per application/service). You authenticate using AWS CLI (docker login), push images (docker push), and pull images (docker pull). ECR integrates with IAM for access control; use repository policies and IAM policies.
Key Capabilities
- Stores Docker container images in private repositories versioned by both mutable tags and immutable image digests
- ECR Public provides an openly accessible registry for sharing images with the broader community without authentication
- Lifecycle policies automatically delete untagged or old images based on age or count rules, preventing silent storage cost accumulation
- Image scanning: basic scanning checks OS packages on push; enhanced scanning via Amazon Inspector runs on push and continuously for OS and language packages
- Cross-region replication copies images to additional regions automatically, reducing pull latency and supporting multi-region deployments
- Pull-through cache proxies and caches images from external public registries (such as Docker Hub) within your private ECR registry
Gotchas & Constraints
Gotcha #1: ECR charges for storage and data transfer; add lifecycle policies to delete unused images. Gotcha #2: Basic scanning (OS packages only) needs scan-on-push enabled per repository. Enhanced scanning through Amazon Inspector is configured once at the registry level, then runs on push and continuously for OS and language packages, billed by Inspector, and also reports which ECS and EKS clusters use each image. Constraints: Maximum 10,000 repositories per account (request increase), no hard limit on images per repository (use lifecycle policies to manage), and maximum 10GB per image layer.
Illustrative scenario; figures are examples, not verified customer results.
A development team builds Docker images for 50 microservices. Storing images in Docker Hub is insecure (public) and slow (external network). They use ECR: create repositories for each service, configure IAM policies (developers can push, ECS can pull), and enable encryption with KMS. They integrate with CodeBuild to build Docker images and push to ECR automatically. They enable image scanning on push. ECR scans for vulnerabilities and sends SNS notifications for critical issues. They create lifecycle policies: keep last 10 images per repository, delete images older than 90 days. For disaster recovery, they enable cross-region replication. Images are automatically replicated to a secondary region. ECS pulls images from ECR when deploying: fast, secure, and no external dependencies.
The Result
secure image storage, automated vulnerability scanning, and direct AWS integration.