From 828462cfc9c41e69f8340b17b59eb04cb4f78d9c Mon Sep 17 00:00:00 2001 From: Ahmed Allam Date: Sun, 4 Oct 2026 22:08:24 +0000 Subject: [PATCH] fix(docker): use the current docker context only, no DOCKER_CONTEXT override --- docs/advanced/configuration.mdx | 6 +----- strix/runtime/docker_connection.py | 2 +- tests/test_docker_connection.py | 16 ---------------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/docs/advanced/configuration.mdx b/docs/advanced/configuration.mdx index 9c5a7131..c245b364 100644 --- a/docs/advanced/configuration.mdx +++ b/docs/advanced/configuration.mdx @@ -150,11 +150,7 @@ When remote vars are set, Strix dual-writes telemetry to both local JSONL and th - Docker daemon address, for example `unix:///var/run/docker.sock` or `tcp://10.0.0.5:2375`. When set, Strix uses it and ignores the docker context. - - - - Docker context to use. Strix connects to the same daemon as the `docker` CLI: `DOCKER_HOST` first, then this context, then the current context from `docker context use`, then the default socket. Docker Desktop, OrbStack and Colima register their sockets as contexts, so no extra configuration is needed for them. + Docker daemon address, for example `unix:///var/run/docker.sock` or `tcp://10.0.0.5:2375`. When not set, Strix connects to the same daemon as the `docker` CLI: the current docker context (`docker context use`), then the default socket. Docker Desktop, OrbStack and Colima register their sockets as contexts, so no extra configuration is needed for them. diff --git a/strix/runtime/docker_connection.py b/strix/runtime/docker_connection.py index 6791a36c..aa821aa9 100644 --- a/strix/runtime/docker_connection.py +++ b/strix/runtime/docker_connection.py @@ -58,7 +58,7 @@ def resolve_docker_endpoint(environ: dict[str, str] | None = None) -> DockerEndp if host: return DockerEndpoint(host, "DOCKER_HOST") - name = env.get("DOCKER_CONTEXT", "").strip() or get_current_context_name() + name = get_current_context_name() if name != DEFAULT_CONTEXT: try: context = ContextAPI.get_context(name) diff --git a/tests/test_docker_connection.py b/tests/test_docker_connection.py index c8ff4a93..7253b2fb 100644 --- a/tests/test_docker_connection.py +++ b/tests/test_docker_connection.py @@ -51,22 +51,6 @@ def test_current_context_is_used_like_the_cli(monkeypatch: pytest.MonkeyPatch) - assert endpoint.source == "docker context 'desktop-linux'" -def test_docker_context_env_overrides_the_config_file(monkeypatch: pytest.MonkeyPatch) -> None: - monkeypatch.setattr(docker_connection, "get_current_context_name", lambda: "default") - seen: list[str] = [] - - def get_context(name: str) -> SimpleNamespace: - seen.append(name) - return SimpleNamespace(Host="unix:///run/orbstack.sock", TLSConfig=None) - - monkeypatch.setattr("strix.runtime.docker_connection.ContextAPI.get_context", get_context) - assert ( - resolve_docker_endpoint({"DOCKER_CONTEXT": "orbstack"}).source - == "docker context 'orbstack'" - ) - assert seen == ["orbstack"] - - def test_default_and_broken_contexts_fall_back_to_the_sdk(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setattr(docker_connection, "get_current_context_name", lambda: "default") assert resolve_docker_endpoint({}) == DockerEndpoint(None, "default socket")