Public Access
DEVX-155: fix: use host Docker when root dir is inaccessible (free=0)
The CI container can't access the host Docker's data root (/home/grm-ci-runner-X/.local/share/docker) to check disk space. When free_bytes=0, the root dir is on the host filesystem (455G). Always use host Docker in that case instead of starting a local dockerd on the 16G /dev/shm tmpfs (which fills up with images). 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
d7c9b7fa94
commit
1470cdae27
@@ -182,6 +182,12 @@ def start_docker_daemon(timeout: int = DEFAULT_TIMEOUT) -> bool:
|
||||
click.echo(f"Docker daemon already running (free space: {free_gb:.1f} GB)")
|
||||
if free_bytes >= MIN_FREE_BYTES:
|
||||
return True
|
||||
# If free_bytes is 0, the Docker root dir is on the host filesystem
|
||||
# (not accessible from inside the container). The host Docker has
|
||||
# access to the full 455G disk — always use it in that case.
|
||||
if free_bytes == 0:
|
||||
click.echo("Host Docker root dir not accessible from container, using host Docker")
|
||||
return True
|
||||
click.echo(
|
||||
f"Host Docker has only {free_gb:.1f} GB free "
|
||||
f"(need ≥ {MIN_FREE_BYTES / 1024**3:.0f} GB), trying rootless sockets..."
|
||||
|
||||
@@ -136,6 +136,16 @@ class TestStartDockerDaemon:
|
||||
mock_ready.assert_called_once()
|
||||
mock_diag.assert_called_once()
|
||||
|
||||
@patch("devx.molecule.start_docker._diagnose_socket")
|
||||
@patch("devx.molecule.start_docker._get_docker_free_bytes", return_value=0)
|
||||
@patch("devx.molecule.start_docker.is_docker_ready", return_value=True)
|
||||
def test_host_socket_inaccessible_root_uses_host(
|
||||
self, mock_ready: MagicMock, mock_free: MagicMock, mock_diag: MagicMock
|
||||
) -> None:
|
||||
"""Should use host Docker when root dir is inaccessible (free=0)."""
|
||||
assert start_docker_daemon(timeout=5) is True
|
||||
mock_ready.assert_called_once()
|
||||
|
||||
@patch("devx.molecule.start_docker._diagnose_socket")
|
||||
@patch("devx.molecule.start_docker._get_docker_free_bytes", return_value=5 * 1024**3)
|
||||
@patch("devx.molecule.start_docker.is_docker_ready", return_value=True)
|
||||
|
||||
Reference in New Issue
Block a user