Skip to content

Find what fills the production host disk, and clean it without touching the 15 GB build cache #756

Open

Description

@HMarzban

Summary

Split from #571 Section 2, step 1. On 2026-10-21, #571 read the host disk at 76 % used and asked for a scheduled clean-up of the Docker build cache and old images. Since then #564 shipped a per-deploy sweep and a cache prune. The disk is still 76 % used (2026-11-11, #749).

This issue measures what holds the disk first. Then it removes only what no rollback and no fast build needs. It never prunes the build cache below its 15 GB reserve. The reserve keeps the CACHED installs (7 of 30, #559) and the #566 A/B. Most of the #559 gain came from --ignore-scripts, not from the reserve.

Why

Reads from the production deploy logs, 2026-11-11 (gh run view <id> --log, step 💾 Pre-deploy disk guard):

Read Value Source
df -h / before the prune 158G size, 120G used, 32G free, 80 % run 43008200172, 2026-11-11
Free after the prune 39 to 42 GiB (printed as "GB"), median 40.5, n = 8 (build): deploys 42344958557 to 43008200172, 2026-11-07 to 2026-11-11
Free before the prune 26 to 37 GiB (printed as "GB"), n = 8 same runs
Build cache after the prune 27.84 to 30.46 GB (26.41 GB reclaimable on the latest) docker system df in the same runs
Images after the prune 20 total, 20 in use, 9.274 GB on 7 of 8 deploys; 23 total, 20 in use on run 42603950298 same
Local volumes 8, 1.722 GB run 43008200172
Host free disk 39,480,020,992 B (76 % used) #749, node_filesystem_avail_bytes, 2026-11-11
  • The guard prunes with docker buildx prune -af --reserved-space 15GB --min-free-space 45GB (.github/workflows/prod.docs.plus.yml:612). It stops when free space reaches its target, so the cache stays near 28 GB. So bytes that a removal frees can turn into kept cache, and free space after the prune then stays flat.
  • free_gb is GiB. free_gib() divides df KiB by 1024² (prod.docs.plus.yml:561), but the log line says "GB".
  • The guard removes each old docsplus-* tag. It keeps DEPLOY_TAG, PREVIOUS_TAG and every image a container uses (prod.docs.plus.yml:566-599). So app images older than last-good are already 0 on most deploys.
  • docker system df lists about 38.8 GB in images, volumes and build cache together. df showed 120G used before the prune. What holds the rest is not measured yet.
  • docker system df counts the reserved cache as reclaimable. A target of "reclaimable under 5 GB" would wipe it. So this issue never uses reclaimable bytes as its metric.
  • The deploy aborts below 20 GB free after the prune (prod.docs.plus.yml:627-631). One build wrote 14 GB on 2026-10-20 (Prune Docker build cache toward a free-disk target and keep rollback images #564).

What to change

  1. Maintainer, on the host, read-only. Find what holds the used space. Post the output, with any path that names a secret or another project replaced by a label:

    df -B1 /
    docker system df -v | head -80
    docker info --format '{{.Driver}} {{json .DriverStatus}}'
    sudo du -xh --max-depth=1 / 2>/dev/null | sort -h | tail -15
    sudo du -xh --max-depth=2 /var/lib/docker /var/lib/containerd /opt 2>/dev/null | sort -h | tail -25
    comm -23 <(docker image ls -q --no-trunc | sort -u) <(docker ps -aq | xargs -r docker inspect -f '{{.Image}}' | sort -u) | wc -l

    The last line counts images that no container uses. Candidates to check: the containerd image store, runner work folders, stage leftovers (Move the production runner to its systemd unit and its own root, and remove the stage runner #743 step 2 owns their removal) and old third-party images.

  2. Agent in the repo. From the step 1 output, draft a list. Each line names one path or image set, its bytes, and whether a rollback or a cached build needs it. Explain why the prune stops at 39–42 GiB free with 28 GB of cache, against its 45 GB target. Post it as a comment. Then stop at a review checkpoint.

  3. Maintainer ruling. Rule which lines to remove, and whether removal runs in each deploy or on a schedule. These never go: the build cache below 15 GB, images at DEPLOY_TAG or PREVIOUS_TAG, images a container uses, and any volume (redis-data and traefik-certs are volumes).

  4. Agent in the repo. If the ruling adds a deploy step, add it after the cache prune in 💾 Pre-deploy disk guard. Print free space before and after it in the step summary. Keep the --reserved-space 15GB flag unchanged. Then stop at a review checkpoint.

  5. Maintainer. Run a one-time removal by hand for anything the ruling does not automate. Run step 1 again after it, and post the result.

Benchmark

Field Value
Metric (a) Used bytes on / outside the build cache, after the prune: df used minus the docker system df build cache size, in GiB. (b) Images that no container uses, other than PREVIOUS_TAG, after each deploy. (c) Build cache after the prune, in GB
Before (a) not measured yet in this form. The maintainer posts it as "Measured, " with run ids, before #747. Context: free after the prune (free_gb, GiB) median 40.5, range 39-42. That is n = 8 (build): deploys, runs 42344958557 to 43008200172, 2026-11-07 to 2026-11-11 (review read). (b) not measured yet: maintainer, step 1. (c) 27.84-30.46 GB, same runs (review read); the maintainer posts it in the same Measured comment
After not measured yet
Condition Production host (before the #747 in-place upgrade, ruled 2026-11-16), 158G root disk, Docker with BuildKit, 5 consecutive (build): deploys after the change. Rows after the #747 upgrade form a new sample
How to run gh run view <run> --log | grep -E "Disk (before|after) prune|Build Cache|^.*Images ", and the step 1 commands on the host
Pass rule (a) median used bytes outside the build cache falls by at least the bytes the ruling removes, minus 2 GiB, on n = 5. (b) 0 on 5 of 5 deploys. (c) at or above 15 GB on 5 of 5. Stop rule: revert the step if a webapp install stops printing CACHED and runs over 20 s on 2 deploys in a row (#559 metric), or if the rollback-image warning prints
Guard The ::warning::Rollback image … is missing line never prints. The #559 install metric stays at or under its after value
Owner Steps 1, 3, 5: maintainer. Steps 2, 4: agent in the repo
Claim Ops ledger: "The production host now holds GiB outside the build cache after each deploy, down from GiB, and it still keeps the 15 GB build cache."

Out of scope

Related

#571 (split from), #564 (the current sweep and prune), #559 and #566 (need the build cache), #743 step 2 (stage leftovers), #747 (in-place upgrade, 11 → 12 → 13), #749 (Prometheus disk), #554. #554 Q4 edits the same prune; #756 lands before Q4, and Q4 folds into step 6 if the cause is build cache. #554 SP1 (the live-run check) gates step 5.

Activity

  1. added this to the v2.3.6 milestone on Nov 11, 2026
  2. HMarzban commented on Nov 14, 2026

    @HMarzban
    CollaboratorAuthor

    Moved to v2.3.7 at the v2.3.6 release audit. The step 1 host read is not posted, so the before and the after are both not measured yet.

  3. modified the milestones: v2.3.6, v2.3.7 on Nov 14, 2026
  4. HMarzban commented on Nov 16, 2026

    @HMarzban
    CollaboratorAuthor

    Review, 2026-11-16 (maintainer approved).

  5. modified the milestones: v2.3.7, v2.4.0 on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions