Docker Compose Drift Detector Skill
Stateless atomic operation to query Docker containers/Swarm services, retrieve active running configurations, parse reference Compose/YAML template repositories, and perform automated drift detection of images, environments, and mounts.
Prerequisites
container-manager-mcp — for inspecting active containers, query image manifests, list service definitions, and inspect active cluster configurations.
Steps
Step 1: retrieve_active_topology
Fetch real-time execution telemetry and configuration parameters from running containers:
- Query active container landscape:
- Fetch list of running containers or Swarm services via
container-manager-mcp (e.g., using list_containers action).
- Filter target containers by namespace, stack name, or specific project identifier.
- Inspect detailed configuration properties:
- Query specific properties of each targeted container or service (image name, image tag, exact registry digest hash, active environment variables, volume mount mappings, network attachments, and replica counts).
- Output parameters:
active_containers: Mapping of container names to their active running state configuration objects.
Step 2: diff_configurations [depends_on: retrieve_active_topology]
Locate and parse target Compose template files and execute differential comparison analysis:
- Locate configuration templates:
- Scan repository folders or target workspace paths for compose files (e.g.,
docker-compose.yml, caddy-compose.yml, stack templates).
- Parse and resolve templates:
- Read target reference compose files.
- Substitute environment variables and
.env properties to resolve template values as they would be generated in deployment.
- Granular differential review:
- Perform element-by-element comparison between the running container configuration and the resolved reference compose file.
- Compare target fields:
- Image/Tag: Verify if the running tag/digest matches the reference specification.
- Environment Overrides: Compare key-value pairs of active environment variables.
- Mount Configuration: Ensure host paths and container mount points are synchronized.
- Replicas/Scale: Check if active counts match template directives.
- Output parameters:
drift_detected: Boolean indicating if any differences were discovered.
drift_matrix: Object mapping each mismatched attribute to its template and running value.
Step 3: report_drift_status [depends_on: diff_configurations]
Categorize drift severity and format telemetry reports:
- Classify drift types:
IMAGE_DRIFT: Indicates container is running an out-of-date image or a different tag compared to the git repository.
ENV_DRIFT: Indicates missing or mismatched environment configuration keys.
SCALE_DRIFT: Indicates replica or service sizing mismatch.
- Compile summary payload:
- Synthesize a comprehensive JSON and Markdown representation of the configuration differences.
- Output parameters:
status: "SUCCESS" or "FAILED"
drift_summary: Markdown summary of detected variations.
severity: String indicating action priority ("NONE", "LOW", "MEDIUM", "HIGH").
1---2name: docker-compose-drift-detector-23skill_type: skill4description: >5 Docker Compose and Swarm configuration drift detection atomic skill.6 Compares running state against git configuration.7domain: system8license: MIT9tags: [docker, swarm, infrastructure, drift]10metadata:11 source: https://skillmd.com/skills/knuckles-team/docker-compose-drift-detector-212 version: '1.6.0'13 author: Genius14requires:15 - container-manager-mcp16---1718# Docker Compose Drift Detector Skill1920Stateless atomic operation to query Docker containers/Swarm services, retrieve active running configurations, parse reference Compose/YAML template repositories, and perform automated drift detection of images, environments, and mounts.2122## Prerequisites2324- `container-manager-mcp` — for inspecting active containers, query image manifests, list service definitions, and inspect active cluster configurations.2526## Steps2728### Step 1: retrieve_active_topology29Fetch real-time execution telemetry and configuration parameters from running containers:30- Query active container landscape:31 - Fetch list of running containers or Swarm services via `container-manager-mcp` (e.g., using `list_containers` action).32 - Filter target containers by namespace, stack name, or specific project identifier.33- Inspect detailed configuration properties:34 - Query specific properties of each targeted container or service (image name, image tag, exact registry digest hash, active environment variables, volume mount mappings, network attachments, and replica counts).35- Output parameters:36 - `active_containers`: Mapping of container names to their active running state configuration objects.3738### Step 2: diff_configurations [depends_on: retrieve_active_topology]39Locate and parse target Compose template files and execute differential comparison analysis:40- Locate configuration templates:41 - Scan repository folders or target workspace paths for compose files (e.g., `docker-compose.yml`, `caddy-compose.yml`, stack templates).42- Parse and resolve templates:43 - Read target reference compose files.44 - Substitute environment variables and `.env` properties to resolve template values as they would be generated in deployment.45- Granular differential review:46 - Perform element-by-element comparison between the running container configuration and the resolved reference compose file.47 - Compare target fields:48 - **Image/Tag**: Verify if the running tag/digest matches the reference specification.49 - **Environment Overrides**: Compare key-value pairs of active environment variables.50 - **Mount Configuration**: Ensure host paths and container mount points are synchronized.51 - **Replicas/Scale**: Check if active counts match template directives.52- Output parameters:53 - `drift_detected`: Boolean indicating if any differences were discovered.54 - `drift_matrix`: Object mapping each mismatched attribute to its `template` and `running` value.5556### Step 3: report_drift_status [depends_on: diff_configurations]57Categorize drift severity and format telemetry reports:58- Classify drift types:59 - `IMAGE_DRIFT`: Indicates container is running an out-of-date image or a different tag compared to the git repository.60 - `ENV_DRIFT`: Indicates missing or mismatched environment configuration keys.61 - `SCALE_DRIFT`: Indicates replica or service sizing mismatch.62- Compile summary payload:63 - Synthesize a comprehensive JSON and Markdown representation of the configuration differences.64- Output parameters:65 - `status`: "SUCCESS" or "FAILED"66 - `drift_summary`: Markdown summary of detected variations.67 - `severity`: String indicating action priority ("NONE", "LOW", "MEDIUM", "HIGH").