Skip to content

fix(preflight): detect stopped Docker daemon via exit code on macOS#2516

Open
jyanimaulik wants to merge 1 commit intoNVIDIA:mainfrom
jyanimaulik:fix/preflight-docker-exit-code
Open

fix(preflight): detect stopped Docker daemon via exit code on macOS#2516
jyanimaulik wants to merge 1 commit intoNVIDIA:mainfrom
jyanimaulik:fix/preflight-docker-exit-code

Conversation

@jyanimaulik
Copy link
Copy Markdown

@jyanimaulik jyanimaulik commented Apr 27, 2026

Summary

Fixes #2348

Problem

assessHost() ran 'docker info --format {{json .}}' with ignoreError:true and treated non-empty stdout as proof the daemon was running. On macOS with Colima stopped, the Docker CLI still emits a client-side JSON struct without contacting the daemon, causing dockerRunning=true incorrectly. Onboarding then passed preflight [1/8] with a false positive and hung indefinitely at [2/8] waiting for gateway health.

Fix

Attempt 'docker info' with ignoreError:false first. If the daemon is unreachable it throws — caught and dockerInfoOutput set to empty string so dockerReachable and dockerRunning remain false. Only on success follow up with the --format call for structured JSON output.

Testing

  • 2044 tests pass, 0 new failures introduced
  • 1 pre-existing failure (ssrf-parity.test.ts) requires npm run build inside nemoclaw/ — unrelated to this change
  • Verified on macOS Apple Silicon M3 Pro with Docker Desktop stopped and running

Summary by CodeRabbit

  • Bug Fixes
    • Improved Docker detection during startup validation to avoid false positives when Docker is unreachable, resulting in more reliable readiness checks and clearer handling of Docker detection failures.

@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented Apr 27, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: cdbff371-208a-472f-a3c2-c372dc5de7e7

📥 Commits

Reviewing files that changed from the base of the PR and between d784c8d and 5568bfc.

📒 Files selected for processing (1)
  • src/lib/preflight.ts

📝 Walkthrough

Walkthrough

The Docker reachability detection in assessHost now runs docker info once without suppressing errors to verify the exit code, and only on success runs the JSON-formatted docker info with error suppression. If the initial call fails, dockerInfoOutput is set to an empty string to avoid false-positive detection.

Changes

Cohort / File(s) Summary
Docker Reachability Detection
src/lib/preflight.ts
Changed assessHost to first run docker info without ignoring errors to check its exit status, then only on success perform the JSON docker info --format '{{json .}}' capture with errors suppressed. Ensures failed CLI/daemon calls do not produce a non-empty JSON that incorrectly marks Docker as running.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 The daemon dozed, the CLI still spoke,
An empty JSON — a sneaky joke.
I check the exit code, then peek inside,
No more false green where sockets hide,
Hopping on truth, with a carrot-certified poke 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main fix: detecting a stopped Docker daemon via exit code on macOS, which directly addresses the root cause identified in issue #2348.
Linked Issues check ✅ Passed The code changes fully implement the required fix by changing the Docker detection logic to check exit codes first and only use formatted output on success, directly addressing all objectives in #2348.
Out of Scope Changes check ✅ Passed All changes in src/lib/preflight.ts are directly related to the Docker daemon detection fix described in the linked issue; no out-of-scope modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

When Colima or Docker Desktop is stopped on macOS, running
'docker info --format {{json .}}' with ignoreError:true still
produces non-empty stdout from the Docker CLI client layer.
assessHost() treated any non-empty output as confirmation the
daemon was reachable, setting dockerRunning=true incorrectly.

This caused nemoclaw onboard to report a false 'Docker is
running' at preflight [1/8] and then hang indefinitely at [2/8]
waiting for gateway health with a socket-not-found error.

Replace the stdout-content check with an exit-code check by
running 'docker info' with ignoreError:false first. A throw
indicates the daemon is unreachable; we catch it and set
dockerInfoOutput to an empty string so dockerReachable and
dockerRunning remain false. Only when the daemon responds
successfully do we follow up with the --format call.

Fixes NVIDIA#2348
@jyanimaulik jyanimaulik force-pushed the fix/preflight-docker-exit-code branch from d784c8d to 5568bfc Compare April 27, 2026 11:31
@wscurran wscurran added bug Something isn't working Platform: macOS Support for macOS Docker Support for Docker containerization labels Apr 27, 2026
@wscurran
Copy link
Copy Markdown
Contributor

✨ Thanks for submitting this pull request that proposes a way to fix a bug where the Docker daemon status is incorrectly detected on macOS.

Related open issues:


Related open issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Docker Support for Docker containerization Platform: macOS Support for macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[NemoClaw][macOS][Onboard] Preflight check [1/8] falsely reports "✓ Docker is running" when Colima daemon is stopped

2 participants