From b791a1a18c2732ede3e09b4cec4b81b5979b4705 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 17 Jun 2025 01:46:05 +0200 Subject: [PATCH] feat: fallback to default socket address when docker.from_env() fails --- core/testcontainers/core/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/testcontainers/core/config.py b/core/testcontainers/core/config.py index f3aa337e5..ad6d2f9ab 100644 --- a/core/testcontainers/core/config.py +++ b/core/testcontainers/core/config.py @@ -33,12 +33,12 @@ def get_docker_socket() -> str: if socket_path := environ.get("TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE"): return socket_path - client = docker.from_env() try: + client = docker.from_env() socket_path = client.api.get_adapter(client.api.base_url).socket_path # return the normalized path as string return str(Path(socket_path).absolute()) - except AttributeError: + except Exception: return "/var/run/docker.sock"