Container + Ghost Hunter: An AI-driven Zombie Container Detection & Automated Lifecycle Management System.
Chost Hunter is an AIOps-based resource optimization solution designed to intelligently detect "Ghost Containers"โidle resources that consume infrastructure costs without providing valueโand perform secure automated reclamation through a snapshot-first workflow.
- ๐ AI-Powered Detection: Goes beyond static thresholds by utilizing Isolation Forest or LSTM models to analyze time-series metric patterns for precise anomaly (zombie) detection.
- ๐ก๏ธ Safety First (Snapshot): Before terminating an idle container, the system executes a
docker committo archive the current state as a.tarimage, ensuring 0% data loss and instant rollback capability. - ๐ค Automated Lifecycle: A seamless end-to-end pipeline: Monitoring โฎ Detection โฎ Alerting โฎ Approval โฎ Recovery.
- Standard Tech Stack: Built on industry-standard open-source tools including cAdvisor, Prometheus, Grafana, and Docker SDK for high reliability and portability.
This diagram illustrates the comprehensive workflow of Chost Hunter, from metric collection to AI analysis and secure resource reclamation.
- Observability:
cAdvisorextracts real-time resource data from managed service containers. - Collection & Storage:
Prometheus TSDBscrapes metrics via Port 8080 and stores them as time-series data. - Visualization:
Grafana Dashboardvisualizes the data, allowing operators to monitor the entire infrastructure at a glance. - AIOps Analysis: The
AI Agentfetches data via PromQL (Port 9090) and processes it through ML models (Isolation Forest/LSTM). - Decision: The system determines if a container is a "Zombie" based on learned patterns.
- Alert & Human-in-the-loop: If a zombie is detected, the
Alert Controllersends a notification to Slack via Webhook. The operator provides final approval or an extension. - Safe Execution: The
Executorinteracts with the Docker Host Engine via Unix Socket to perform:- Phase 1: Create a snapshot image (
.tar) and store it inSnapshot Storage. - Phase 2: Stop the target container once the snapshot is verified.
- Phase 1: Create a snapshot image (
- Infrastructure: Linux / Docker Host Engine
- Monitoring & Storage: Prometheus, cAdvisor
- Visualization: Grafana
- Analysis & Execution Agent:
- Language: Python 3.9+
- AI/ML: Scikit-learn, PyTorch, Pandas
- Control: Docker SDK for Python
- Collaboration: Slack (Outgoing Webhook)
You can deploy the entire Chost Hunter stack (cAdvisor, Prometheus, Grafana, and the Agent) using docker-compose.
# 1. Clone the repository
git clone [https://github.com/jagggged/chost-hunter.git](https://github.com/jagggged/chost-hunter.git)
cd chost-hunter
# 2. Configure environment variables
cp .env.example .env
# Edit .env with your Slack tokens and credentials
# 3. Launch the system
docker-compose up -d