diff --git a/packages/infra/scripts/prune-registry.sh b/packages/infra/scripts/prune-registry.sh index 9607d70..0d5cf46 100644 --- a/packages/infra/scripts/prune-registry.sh +++ b/packages/infra/scripts/prune-registry.sh @@ -43,8 +43,15 @@ for repo_dir in "$REGISTRY_DATA/repositories/mintel/"*; do done # 2. Run Garbage Collection -echo "♻️ Running Registry Garbage Collection..." -docker exec registry-registry-1 bin/registry garbage-collect /etc/docker/registry/config.yml --delete-untagged +echo "♻️ Detecting Registry Container..." +REGISTRY_CONTAINER=$(docker ps --format "{{.Names}}" | grep registry | head -1 || true) + +if [ -n "$REGISTRY_CONTAINER" ]; then + echo "♻️ Running Registry Garbage Collection on $REGISTRY_CONTAINER..." + docker exec "$REGISTRY_CONTAINER" bin/registry garbage-collect /etc/docker/registry/config.yml --delete-untagged +else + echo "⚠️ Registry container not found. Skipping GC." +fi # 3. Prune Host Docker resources (Shorter window: 24h) echo "🧹 Pruning Host Docker resources..."