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

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 committed 2026-06-11 00:30:10 -05:00
1 parent 35173645d0
commit 90ec7eb14b
2 files changed
+14 -2

No files matched your search

+4
View File
@@ -7,6 +7,10 @@ This project uses [Semantic Versioning](https://semver.org/).
## [Unreleased] ## [Unreleased]
### Fixed
- `floci doctor`'s `docker.daemon` check reported "Docker daemon not reachable" under Podman even when the daemon was clearly up (container running, endpoint reachable). The probe used `docker info --format '{{.ServerVersion}}'`, a Docker-only template field that errors under `podman info`. It now checks daemon reachability by exit code alone (`docker info` / `podman info` exit 0 when reachable), with output discarded to avoid a pipe-buffer deadlock
## [0.1.5] — 2026-06-10 ## [0.1.5] — 2026-06-10
### Added ### Added
@@ -30,8 +30,16 @@ public class DockerClient {
public boolean isDaemonReachable() { public boolean isDaemonReachable() {
try { try {
int code = runProcess("docker", "info", "--format", "{{.ServerVersion}}").waitFor(); // Probe connectivity by exit code only. `docker info` / `podman info`
return code == 0; // 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) { } catch (Exception e) {
return false; return false;
} }