Introduction CI/CD runners that run out of disk space fail all builds. This is especially common with self-hosted runners that accumulate Docker images, build artifacts, and workspace files over time.

Symptoms - Build fails with: "No space left on device" - Error: "failed to write: no space left on device" - Docker build fails: "overlay2: no space left on device" - Runner shows 100% disk usage in monitoring - Builds fail intermittently based on runner selection

Common Causes - Docker images not pruned between builds - Build artifacts accumulating in workspace - npm/pip/maven caches growing unbounded - Git repository clones accumulating (bare repos) - Core dump files from crashed processes

Step-by-Step Fix 1. **Check disk usage on the runner**: ```bash df -h du -sh /home/runner/work/* | sort -rh | head -10 docker system df ```

  1. 1.Clean up Docker images:
  2. 2.```bash
  3. 3.docker system prune -af --volumes
  4. 4.docker image prune -af
  5. 5.`
  6. 6.Clean up workspace directories:
  7. 7.```bash
  8. 8.# GitHub Actions
  9. 9.rm -rf /home/runner/work/*
  10. 10.# GitLab CI
  11. 11.rm -rf /builds/*
  12. 12.`
  13. 13.Add cleanup step to pipeline:
  14. 14.```yaml
  15. 15.# GitHub Actions
  16. 16.- name: Cleanup
  17. 17.if: always()
  18. 18.run: |
  19. 19.docker system prune -af
  20. 20.rm -rf $GITHUB_WORKSPACE/*
  21. 21.`

Prevention - Configure runner self-hosted cleanup scripts as cron jobs - Set Docker storage driver with image pruning policies - Use external artifact storage (S3, GCS) instead of local - Monitor runner disk usage with alerts - Set up automatic runner replacement when disk > 80%