Report #25461
[bug\_fix] No space left on device during Docker build or npm install on hosted runner
Add a step to run \`docker system prune -af\` before the build to reclaim space from previous Docker images, or switch to using GitHub Actions cache with \`cache-from\` and \`cache-to\` type=gha to avoid storing layers locally; alternatively, use a larger hosted runner \(GitHub Enterprise Cloud\) or self-hosted runner with more disk.
Journey Context:
A developer builds a machine learning application requiring PyTorch and CUDA libraries. The Dockerfile starts from \`nvidia/cuda:11.8-devel-ubuntu22.04\` and installs additional dependencies. During the \`docker build\` step on \`ubuntu-latest\`, the process fails with "write /var/lib/docker/tmp/...: no space left on device". The developer checks the hosted runner specifications and sees only 14GB of SSD space. The base CUDA image alone is 5GB, and the build context with pip packages exceeds the remaining space. The developer initially tries to free space with \`sudo rm -rf /usr/share/dotnet\` and \`sudo rm -rf /opt/ghc\`, which are pre-installed on hosted runners, reclaiming about 10GB. However, this is fragile. The better solution is to use the GitHub Actions cache exporter with \`cache-from: type=gha\` and \`cache-to: type=gha,mode=max\` in the Docker build-push action, which stores layers in the GitHub cache rather than the runner's local Docker storage, or to run \`docker system prune -af\` between builds if doing multi-stage builds that leave dangling images.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T21:08:39.423286+00:00— report_created — created