🐛 Keep the nested docker clean after CI runs
gitea / release-gitea (push) Successful in 12m4s

- rootfs/tmp/etc/act_runner/default_config.yaml: idle_cleanup_interval, workdir_cleanup_age, post_task_script, container.sweep and a health_check that pauses new tasks below 100 GiB free (runner count and capacity unchanged)
- rootfs/usr/local/bin/runner-post-task: new, prunes stopped containers, dangling images, build cache and unused volumes after every task, every unused image when free space is low
- rootfs/usr/local/bin/cleanup-runners: prune age 72h -> 6h; low-space guard uses free MiB on the nested docker root (asked from docker) instead of the percent of a path that did not exist
- rootfs/usr/local/etc/docker/init.d/05-dockerd.sh: start the nested docker from empty data (RUNNER_DOCKER_WIPE_ON_START, default yes) so layers from killed jobs never pile up
This commit is contained in:
casjay committed 2026-11-27 10:59:13 -05:00
1 parent ca3bfb242a
commit ee13ddf242
4 files changed
+93 -15

No files matched your search

@@ -391,6 +391,15 @@ __run_pre_execute_checks() {
# safe to clear docker's own pidfile here before each start attempt.
[ -f "/tmp/docker.pid" ] && rm -f "/tmp/docker.pid"
# The nested docker only holds CI scratch (job layers, build cache, pulled images), so start it
# from empty data: layers left behind by jobs that were killed mid-run never pile up, and with the
# vfs storage driver each of them is a full copy of an image. Set RUNNER_DOCKER_WIPE_ON_START=no to keep it
if [ "${RUNNER_DOCKER_WIPE_ON_START:-yes}" = "yes" ]; then
for docker_data_dir in buildkit containerd containers image network overlay2 fuse-overlayfs plugins runtimes swarm tmp vfs volumes; do
[ -d "/var/lib/docker/$docker_data_dir" ] && rm -rf "/var/lib/docker/${docker_data_dir:?}"
done
fi
# Clean up orphaned containers before dockerd starts
# This prevents "failed to load container" errors on restart
if [ -d "/data/docker/containers" ]; then