Skip to content

fix(adapters): avoid single-quoted docker daemon probe over SSH exec - #422

Open
santhiprakash wants to merge 1 commit into
oblien:mainfrom
santhiprakash:fix/docker-health-ssh-exec-408
Open

fix(adapters): avoid single-quoted docker daemon probe over SSH exec#422
santhiprakash wants to merge 1 commit into
oblien:mainfrom
santhiprakash:fix/docker-health-ssh-exec-408

Conversation

@santhiprakash

Copy link
Copy Markdown
Contributor

Summary

Fix Docker health check false negatives on SSH-added external servers by replacing the Go-template docker info --format probe with a quote-safe exit-status check.

Motivation

Closes #408.

On SSH-added servers, the Components tab reported Docker as unhealthy ("daemon not running") even though docker info, docker ps, and docker --version all succeeded from the interactive Terminal tab on the same connection.

Related issue

Closes #408

Changes

  • packages/adapters/src/system/catalog.ts — change daemonCommand from docker info --format '{{.ServerVersion}}' to docker info >/dev/null 2>&1 && echo ok, avoiding single-quoted Go template braces that break when sshd wraps the exec command in sh -c '…'.
  • packages/adapters/src/system/catalog.test.ts — regression tests ensuring the daemon probe has no single-quoted Go templates and still verifies the daemon via docker info exit status.

Problem

Concrete repro from #408: add an external server over password-auth SSH where Docker is installed and running. Terminal tab commands (docker info, docker ps) succeed, but the Components tab health check calls checkDocker()tryExec(executor, recipe.daemonCommand) with docker info --format '{{.ServerVersion}}'. The inner single quotes terminate the outer sh -c quote, the command fails, tryExec() swallows the error, and the UI shows "Docker is installed but the daemon is not running."

Triage / Root cause

systemCatalog.checks.docker.daemonCommand embedded single-quoted Go template syntax. Non-interactive SSH exec runs the command through a shell wrapper; the inner '{{.ServerVersion}}' breaks quoting. The interactive Terminal tab uses a PTY shell path (SshExecutor.openShell) which does not hit this quoting issue.

Fix

Use docker info >/dev/null 2>&1 && echo ok — no embedded single quotes, relies on exit status only. checkDocker() already treats any non-empty tryExec result as "daemon running"; the probe does not need to parse ServerVersion.

Verification

cd packages/adapters && bun test src/system/catalog.test.ts
# 20 pass, 0 fail (includes new #408 regression tests)

Notes / Risks

  • Scope is limited to the daemon probe string in the system catalog; no changes to SshExecutor or checkDocker() control flow.
  • The old command still worked for local/non-SSH executors; this change is safe for all paths since we only need a running-daemon boolean.

Checklist

  • One change per PR — one bug, or one agreed feature, with nothing unrelated bundled in
  • The diff is scoped — no reformatting or lint fixes on lines I wasn't otherwise changing
  • A test fails without this change and passes with it (or I explained above why there isn't one)
  • bun run test, bun run --cwd <workspace> lint, and bun format all pass locally
  • I understand every line of this diff and can explain it in review

- Problem: Components tab reported Docker unhealthy on SSH-added servers
  even when `docker info` worked in the Terminal tab (oblien#408).
- Fix: replace the Go-template `docker info --format` probe with a
  quote-safe `docker info >/dev/null` exit-status check.
- Verification: `bun run test src/system/catalog.test.ts` (20 passed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker health check shows Unhealthy on external server added via SSH (password auth) despite Docker running normally

1 participant