Conversation
Read $DOCKER_CONFIG/contexts/meta/<sha256(name)>/meta.json and the optional TLS bundle under contexts/tls/<id>/docker/ to build a Client from a named docker CLI context. The reserved name "default" resolves to the platform default host. ssh:// endpoints are rejected explicitly since this library has no SSH dialer. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When DOCKER_HOST is unset, look up the active context (DOCKER_CONTEXT, falling back to currentContext in config.json) and build the client from it. DOCKER_HOST keeps full precedence over contexts, matching the docker CLI's resolution order. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
|
Sorry I lost track of this, can you rebase so CI can run again? |
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.
Summary
NewContextClient(name)/NewVersionedContextClient(name, apiVersion)build a client from a named docker CLI context by reading$DOCKER_CONFIG/contexts/meta/<sha256(name)>/meta.jsonand the optional TLS bundle undercontexts/tls/<id>/docker/. The reserved namedefault(or"") resolves to the platform default host.NewClientFromEnv/NewVersionedClientFromEnvnow match the docker CLI's resolution order:DOCKER_HOSTkeeps full precedence; when it's unset the client falls back toDOCKER_CONTEXT, then thecurrentContextfield ofconfig.json, then the default socket.ssh://context endpoints are rejected with a clear error since this library has no SSH dialer.Test plan
go test ./...(unit tests, Linux/macOS)NewClientFromEnvwithDOCKER_HOSTset still hits that host (existing tests cover this)NewClientFromEnvwith adocker context use <name>selecting atcp://context picks up that hostNewContextClient("default")resolves to the platform default host without touching diskNewContextClienton a missing context returns a clear "not found" errorNewContextClienton anssh://context returns an explanatory error🤖 Generated with Claude Code