mirror of
https://github.com/floci-io/floci-cli.git
synced 2026-11-22 21:50:47 -05:00
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:
1 parent
35173645d0
commit
97ab1d527b
2 files changed
+14
-2
No files matched your search
@@ -7,6 +7,10 @@ This project uses [Semantic Versioning](https://semver.org/).
|
||||
|
||||
## [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
|
||||
|
||||
### Added
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user