|
| 1 | +# Docker Troubleshooting Flow - Zero Setup |
| 2 | +# |
| 3 | +# A multi-step workflow that diagnoses Docker container issues: |
| 4 | +# 1. Check container status |
| 5 | +# 2. Analyze logs if container is unhealthy |
| 6 | +# 3. Recommend fixes |
| 7 | +# |
| 8 | +# Prerequisites: |
| 9 | +# - Docker installed and running |
| 10 | +# - Google AI Studio API key (free): https://aistudio.google.com/apikey |
| 11 | +# |
| 12 | +# Usage: |
| 13 | +# export GOOGLE_API_KEY=AIza... |
| 14 | +# |
| 15 | +# # Diagnose all containers |
| 16 | +# aofctl run flow docker-troubleshoot-flow.yaml --input "diagnose" |
| 17 | +# |
| 18 | +# # Diagnose specific container |
| 19 | +# aofctl run flow docker-troubleshoot-flow.yaml --input "diagnose container nginx" |
| 20 | +# |
| 21 | +# This flow demonstrates: |
| 22 | +# - Multi-step agent orchestration |
| 23 | +# - Sequential node execution |
| 24 | +# - Conditional branching (if issues found) |
| 25 | + |
| 26 | +apiVersion: aof.dev/v1 |
| 27 | +kind: AgentFlow |
| 28 | +metadata: |
| 29 | + name: docker-troubleshoot-flow |
| 30 | + labels: |
| 31 | + category: quickstart |
| 32 | + difficulty: beginner |
| 33 | + setup: zero |
| 34 | + |
| 35 | +spec: |
| 36 | + description: "Diagnose Docker container health issues" |
| 37 | + |
| 38 | + nodes: |
| 39 | + # Step 1: Check container status |
| 40 | + - id: check-status |
| 41 | + type: Agent |
| 42 | + config: |
| 43 | + inline: |
| 44 | + name: status-checker |
| 45 | + model: google:gemini-2.5-flash |
| 46 | + temperature: 0 |
| 47 | + instructions: | |
| 48 | + Run `docker ps -a` to list all containers. |
| 49 | +
|
| 50 | + Report: |
| 51 | + 1. Number of running containers |
| 52 | + 2. Number of stopped/exited containers |
| 53 | + 3. Any containers in unhealthy state |
| 54 | +
|
| 55 | + If there are stopped containers, list their names and exit codes. |
| 56 | +
|
| 57 | + Output format: |
| 58 | + RUNNING: [count] |
| 59 | + STOPPED: [count] |
| 60 | + UNHEALTHY: [list of container names or "none"] |
| 61 | + tools: |
| 62 | + - docker |
| 63 | + |
| 64 | + # Step 2: Analyze logs for unhealthy containers |
| 65 | + - id: analyze-logs |
| 66 | + type: Agent |
| 67 | + config: |
| 68 | + inline: |
| 69 | + name: log-analyzer |
| 70 | + model: google:gemini-2.5-flash |
| 71 | + temperature: 0.1 |
| 72 | + instructions: | |
| 73 | + Based on the container status, analyze logs for any unhealthy |
| 74 | + or recently exited containers. |
| 75 | +
|
| 76 | + For each problematic container: |
| 77 | + 1. Run `docker logs --tail 50 <container>` |
| 78 | + 2. Look for error patterns |
| 79 | + 3. Identify the root cause |
| 80 | +
|
| 81 | + If no problematic containers, confirm all is healthy. |
| 82 | + tools: |
| 83 | + - docker |
| 84 | + |
| 85 | + # Step 3: Recommend fixes |
| 86 | + - id: recommend-fixes |
| 87 | + type: Agent |
| 88 | + config: |
| 89 | + inline: |
| 90 | + name: fix-recommender |
| 91 | + model: google:gemini-2.5-flash |
| 92 | + temperature: 0.3 |
| 93 | + instructions: | |
| 94 | + Based on the log analysis, provide actionable recommendations. |
| 95 | +
|
| 96 | + For each issue found: |
| 97 | + 1. Explain the problem in simple terms |
| 98 | + 2. Provide the exact command to fix it |
| 99 | + 3. Explain any risks or considerations |
| 100 | +
|
| 101 | + Format: |
| 102 | + ## Issue: [brief description] |
| 103 | + **Cause:** [explanation] |
| 104 | + **Fix:** `[exact command]` |
| 105 | + **Notes:** [any warnings or tips] |
| 106 | +
|
| 107 | + If everything is healthy, confirm and suggest preventive measures. |
| 108 | + tools: |
| 109 | + - docker |
| 110 | + |
| 111 | + connections: |
| 112 | + - from: start |
| 113 | + to: check-status |
| 114 | + - from: check-status |
| 115 | + to: analyze-logs |
| 116 | + - from: analyze-logs |
| 117 | + to: recommend-fixes |
0 commit comments