Open-source AI penetration testing tool to find and fix your app’s vulnerabilities.
Python agentsai-hackingai-penetration-testingai-pentestingai-securityartificial-intelligencebug-bountycode-qualityctf-toolscybersecuritycybersecurity-toolsethical-hackinghackingllm-securityoffensive-securitypenetration-testingpentesting-toolsred-teamingsecuritysecurity-automation
fix(docker): use the current docker context only, no DOCKER_CONTEXT override
Ahmed Allam828462cfc9c4
diff --git a/docs/advanced/configuration.mdx b/docs/advanced/configuration.mdxindex 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</ParamField><ParamField path="DOCKER_HOST" type="string">- 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.-</ParamField>--<ParamField path="DOCKER_CONTEXT" type="string">- 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.</ParamField><ParamField path="STRIX_RUNTIME_BACKEND" default="docker" type="string">diff --git a/strix/runtime/docker_connection.py b/strix/runtime/docker_connection.pyindex 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) -> DockerEndpif 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.pyindex 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")