Skip to content

fix(reach-cli): resolve the active Docker CLI context when DOCKER_HOST is unset (CER-3687) - #28

Merged
sorcerai merged 1 commit into
unsigned-gg:mainfrom
sorcerai:fix/cer-3687-docker-context
Nov 12, 2026
Merged

sorcerai merged 1 commit into
unsigned-gg:mainfrom
sorcerai:fix/cer-3687-docker-context

Conversation

@sorcerai

Copy link
Copy Markdown
Contributor

Problem

On a host whose active Docker context is rootless (unix:///run/user/1000/docker.sock), bare reach list fails with Error: Socket not found: /var/run/docker.sock. It works when DOCKER_HOST is set to the rootless socket. Linear: CER-3687.

Change

DockerClient::new now resolves the Docker endpoint in this order:

  1. [docker].socket in the reach config, when set (it was read but never used before; the default is empty)
  2. DOCKER_HOST
  3. the active Docker CLI context: DOCKER_CONTEXT, else currentContext in the Docker config (DOCKER_CONFIG is honoured). The context named default is skipped.
  4. $XDG_RUNTIME_DIR/docker.sock, when it exists and /var/run/docker.sock does not
  5. the previous default

A missing, unreadable or malformed config or context file falls through to the next step.

New dependency: sha2, for the hash Docker uses to name a context's directory.

Tests

  • cargo test -p reach-cli: 79 passed. Seven new resolver tests use a temp dir as the Docker config dir.
  • cargo clippy -p reach-cli --all-targets --no-deps -- -D warnings: clean.
  • cargo clippy -p reach-cli --all-targets -- -D warnings fails on main too, on crates/reach-scraper/src/adaptive.rs:103 (collapsible_if). Not touched here.

Not covered

  • A context whose endpoint is ssh:// is passed to the local-socket connector and fails. Follow-up.
  • Tested against a fixture socket, not a real rootless daemon.

🤖 Generated with Claude Code

…T is unset (CER-3687)

Bare `reach list` failed with "Socket not found: /var/run/docker.sock" on a
host whose active Docker context is rootless. The Docker endpoint is now
resolved in this order: the [docker].socket config value, DOCKER_HOST, the
active CLI context (DOCKER_CONTEXT, else currentContext in the Docker
config), $XDG_RUNTIME_DIR/docker.sock when /var/run/docker.sock is absent,
then the previous default. A missing or malformed config file falls through
to the next step.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@sorcerai
sorcerai requested a review from todie as a code owner November 12, 2026 13:23
@sorcerai
sorcerai merged commit 1ec0cb3 into unsigned-gg:main Nov 12, 2026
11 checks 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.

1 participant