Q: How do you implement a Docker image garbage collection policy in a registry?
ECR lifecycle policies: keep only last N images, delete untagged images after X days. aws ecr put-lifecycle-policy --lifecycle-policy-tex...
#Docker #Docker #L3 #Containers #Linux
🎙️ Candidate Opening & Architectural Context
""When containerizing our microservices stack, container lifecycle and resource management were critical. When addressing this question, I walk the interviewer through our production incident runbook: isolating the blast radius, checking diagnostic logs and metrics, and applying a safe fix.""
Advertisement
🛠️ Production Runbook & Step-by-Step Resolution
1️⃣
Production Solution & Architecture
ECR lifecycle policies: keep only last N images, delete untagged images after X days. aws ecr put-lifecycle-policy --lifecycle-policy-text file://policy.json. For Docker Hub: use retention policies. This prevents registry storage costs from growing indefinitely.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: ECR lifecycle policies: keep only last N images, delete untagged images after X days. aws ecr put-lifecycle-policy --lifecycle-pol."
⚡ 60-Second Elevator Pitch Talking Points
- Immediate Triage: ECR lifecycle policies: keep only last N images, delete untagged images after X days. aws ecr p
- Run targeted verification commands before modifying configuration.
- Automate permanent guardrails (CI check, alerts, IaC policy) to prevent recurrence.
Advertisement