docs: add Docker cleanup instructions to prevent disk full issues

- Document build cache accumulation problem (40-50 GB typical)
- Add cleanup commands: image prune, builder prune, volume prune
- Recommend running after each deployment or weekly
- Typical space freed: 40-55 GB per cleanup
- Clarify what's safe vs not safe to delete
- Part of maintaining healthy development environment
This commit is contained in:
mindesbunister
2025-11-14 10:46:15 +01:00
parent 6c5a235ea5
commit a0dc80e96b
2 changed files with 44 additions and 1 deletions

View File

@@ -292,6 +292,49 @@ docker logs trading-bot-v4 | grep "Server starting" | head -1
**DO NOT use:** `docker compose build trading-bot` in foreground - one network hiccup kills 60s of work
### Docker Cleanup After Builds
**CRITICAL: Prevent disk full issues from build cache accumulation**
Docker builds create intermediate layers (1.3+ GB per build) that accumulate over time. Build cache can reach 40-50 GB after frequent rebuilds.
**After successful deployment, clean up:**
```bash
# Remove dangling images (old builds)
docker image prune -f
# Remove build cache (biggest space hog - 40+ GB typical)
docker builder prune -f
# Optional: Remove dangling volumes (if no important data)
docker volume prune -f
# Check space saved
docker system df
```
**When to run:**
- After each successful deployment (recommended)
- Weekly if building frequently
- When disk space warnings appear
- Before major updates/migrations
**Space typically freed:**
- Dangling images: 2-5 GB
- Build cache: 40-50 GB
- Dangling volumes: 0.5-1 GB
- **Total: 40-55 GB per cleanup**
**What's safe to delete:**
- `<none>` tagged images (old builds)
- Build cache (recreated on next build)
- Dangling volumes (orphaned from removed containers)
**What NOT to delete:**
- Named volumes (contain data: `trading-bot-postgres`, etc.)
- Active containers
- Tagged images currently in use
---
## Critical Components

View File

@@ -109,7 +109,7 @@ async function validateOpenTrades() {
}
// Position EXISTS on Drift
const driftDirection = position.direction.toLowerCase() as 'long' | 'short'
const driftDirection = position.side.toLowerCase() as 'long' | 'short'
if (driftDirection !== trade.direction) {
console.log(`⚠️ DIRECTION MISMATCH: ${trade.symbol} DB=${trade.direction} Drift=${driftDirection}`)