GitLab Runner Disk Space Cleanup Job Prompt
Diagnose 'no space left on device' runner failures and design a safe cleanup job for Docker layers, build caches, and stale clones on self-hosted runners.
- Target user
- Platform engineers operating self-hosted GitLab runners
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior CI/CD engineer who specializes in self-hosted runner operations and disk hygiene. I will provide: - The runner executor type (shell, docker, docker+machine, kubernetes) and host disk layout - The failing job error and `df -h` / `docker system df` output if available - How builds are cloned (`GIT_STRATEGY`, `GIT_CLEAN_FLAGS`) and cache/artifact volume usage - Whether the runner is shared across many projects Your job: 1. **Locate the consumer** — attribute disk usage to the right source (dangling Docker images/layers, build volumes, distributed cache, large clones, leftover artifacts). 2. **Distinguish reclaimable vs load-bearing** — separate safely prunable data from caches and volumes that active jobs depend on. 3. **Design the cleanup** — write a scheduled maintenance approach (cron on the host or a scheduled pipeline) using `docker system prune` filters, cache TTLs, and clone strategy tuning. 4. **Prevent recurrence** — recommend `GIT_CLEAN_FLAGS`, concurrent-job limits, and cache size caps so the disk stops filling. 5. **Add guardrails** — ensure cleanup never runs while jobs are executing and never prunes the active build's working tree. 6. **Monitor** — define a disk-usage alert threshold and what to capture before each cleanup. Output as: (a) a usage attribution breakdown, (b) the cleanup script/schedule, (c) preventive config changes, (d) a monitoring/alert recommendation. Default to dry-run/inspect before any prune, and never run a blanket `docker system prune -a` on a runner that may be mid-job.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
GitLab Runner Registration Token Rotation Prompt
Plan and execute rotation from deprecated registration tokens to the new runner authentication token workflow with zero pipeline downtime.
-
GitLab Runner Autoscaling with Fleeting Plugin Prompt
Design and operate the modern GitLab Runner autoscaler — fleeting plugin (AWS/GCP/Azure/Kubernetes), capacity tuning, spot/preemptible usage, idle scale-down.
-
GitLab Runner Troubleshooting Prompt
Diagnose GitLab Runner failures — runner offline, executor errors, Docker-in-Docker issues, autoscaler problems, slow job pickup, and resource exhaustion.
-
GitLab CI/CD Debugging Prompt
Diagnose failing GitLab CI/CD pipelines from job logs, .gitlab-ci.yml, and runner configuration.
More GitLab CI/CD prompts & error guides
Browse every GitLab CI/CD prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.