Public Access
DEVX-155: fix: start local dockerd instead of using low-space inner dockerd
When no socket has sufficient space, don't fall back to the low-space inner dockerd (which will fail on image pulls). Instead, kill the inner dockerd, clean up its data root to free space, and start a local dockerd on /dev/shm with vfs storage driver. Also adds pkill of the inner dockerd and cleanup of its data root (overlay2, image, volumes, containers) before starting the local dockerd, to free up the 2.4GB used by the inner dockerd's data. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
0e25810b84
commit
a2d47b7efc
@@ -212,15 +212,33 @@ def start_docker_daemon(timeout: int = DEFAULT_TIMEOUT) -> bool:
|
||||
return True
|
||||
click.echo(f" Insufficient space ({free_gb:.1f} GB), trying next...")
|
||||
|
||||
# If we found a working socket but with low space, use the last
|
||||
# one as a fallback (better than nothing).
|
||||
for sock in reversed(candidates):
|
||||
if _try_socket(sock):
|
||||
click.echo(f"Using low-space fallback: {sock}")
|
||||
return True
|
||||
|
||||
# No socket with sufficient space found.
|
||||
# Don't fall back to the low-space inner dockerd — it will fail
|
||||
# on image pulls. Instead, start a local dockerd on /dev/shm.
|
||||
click.echo(_("Host Docker not available, starting local dockerd..."))
|
||||
|
||||
# Kill the inner dockerd (started by the CI image) to free its
|
||||
# data root and socket. The inner dockerd uses the container's
|
||||
# overlay (38G, often 100% full). Killing it frees up the
|
||||
# socket and any space used by its containers/volumes.
|
||||
with contextlib.suppress(Exception):
|
||||
subprocess.run( # nosec B603 B607
|
||||
["pkill", "-f", "dockerd.*--host fd://"],
|
||||
check=False,
|
||||
timeout=5,
|
||||
)
|
||||
time.sleep(2)
|
||||
|
||||
# Clean up the inner dockerd's data root to free space
|
||||
inner_data_root = "/home/grm-ci-runner-*/.local/share/docker"
|
||||
rm_paths = " ".join(f"{inner_data_root}/{d}" for d in ("overlay2", "image", "volumes", "containers"))
|
||||
with contextlib.suppress(Exception):
|
||||
subprocess.run( # nosec B603 B607
|
||||
["sh", "-c", f"rm -rf {rm_paths}"],
|
||||
check=False,
|
||||
timeout=30,
|
||||
)
|
||||
|
||||
# The existing dockerd (started by the CI image) uses the default data
|
||||
# root on the CI container's overlay (38G, often 100% full). We can't
|
||||
# kill it (different PID namespace) or bind to the same socket. Use a
|
||||
|
||||
Reference in New Issue
Block a user