Continuing from Day 4, today we explore Amazon Elastic Container Registry (ECR), AWS's managed Docker registry. We'll create a repo and manage it.
Why ECR?
ECR stores Docker images securely, integrates with ECS, and handles authentication automatically.
Step 1: Create an ECR Repository
Via Console:
- Search for ECR in AWS Console.
- Click "Create repository."
- Choose private/public, name it (e.g., my-app-repo).
- Create.
Via CLI:
aws ecr create-repository --repository-name my-app-repo --region us-west-2
Step 2: Managing Repositories
- Public vs. Private: Private for internal use; public for sharing.
- Lifecycle Policies: To clean old images, add policy via console (e.g., expire untagged images after 30 days).
{ "rules": [ { "rulePriority": 1, "description": "Expire untagged images", "selection": { "tagStatus": "untagged", "countType": "sinceImagePushed", "countUnit": "days", "countNumber": 30 }, "action": { "type": "expire" } } ] }
Verify: aws ecr describe-repositories
Today’s Takeaway
ECR is set up! Tomorrow, push images to it.
What’s Next?
In Day 6, we’ll integrate Docker with ECR.
Top comments (0)