fix(doctor): make docker.daemon check work under Podman (#7)

isDaemonReachable() probed the daemon with 'docker info --format
{{.ServerVersion}}', a Docker-only template field. Under the podman-docker shim
'podman info' has no .ServerVersion, so the template errors and exits non-zero —
a false 'Docker daemon not reachable' even while containers run fine via the
DOCKER_HOST socket. Probe by exit code instead (docker/podman info exit 0 when
reachable) and discard output to avoid a pipe-buffer deadlock on waitFor().
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-06-11 00:33:21 -05:00
1 parent 35173645d0
commit 97ab1d527b
2 files changed
+14 -2

No files matched your search

@@ -30,8 +30,16 @@ public class DockerClient {
public boolean isDaemonReachable() {
try {
int code = runProcess("docker", "info", "--format", "{{.ServerVersion}}").waitFor();
return code == 0;
// Probe connectivity by exit code only. `docker info` / `podman info`
// exit 0 when the daemon (or DOCKER_HOST socket) is reachable. Avoid a
// Docker-only template field like {{.ServerVersion}}, which errors under
// Podman and yields a false "daemon not reachable". Output is discarded
// so the unread pipe can't fill and deadlock waitFor().
Process p = new ProcessBuilder("docker", "info")
.redirectOutput(ProcessBuilder.Redirect.DISCARD)
.redirectError(ProcessBuilder.Redirect.DISCARD)
.start();
return p.waitFor() == 0;
} catch (Exception e) {
return false;
}