Repository navigation
fix(reach-cli): resolve the active Docker CLI context when DOCKER_HOST is unset (CER-3687) - #28
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On a host whose active Docker context is rootless (
unix:///run/user/1000/docker.sock), barereach listfails withError: Socket not found: /var/run/docker.sock. It works whenDOCKER_HOSTis set to the rootless socket. Linear: CER-3687.Change
DockerClient::newnow resolves the Docker endpoint in this order:[docker].socketin the reach config, when set (it was read but never used before; the default is empty)DOCKER_HOSTDOCKER_CONTEXT, elsecurrentContextin the Docker config (DOCKER_CONFIGis honoured). The context nameddefaultis skipped.$XDG_RUNTIME_DIR/docker.sock, when it exists and/var/run/docker.sockdoes notA 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 warningsfails on main too, oncrates/reach-scraper/src/adaptive.rs:103(collapsible_if). Not touched here.Not covered
ssh://is passed to the local-socket connector and fails. Follow-up.🤖 Generated with Claude Code