Skip to content

Commit b791a1a

Browse files
committed
feat: fallback to default socket address when docker.from_env() fails
1 parent 632e5f4 commit b791a1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/testcontainers/core/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ def get_docker_socket() -> str:
3333
if socket_path := environ.get("TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE"):
3434
return socket_path
3535

36-
client = docker.from_env()
3736
try:
37+
client = docker.from_env()
3838
socket_path = client.api.get_adapter(client.api.base_url).socket_path
3939
# return the normalized path as string
4040
return str(Path(socket_path).absolute())
41-
except AttributeError:
41+
except Exception:
4242
return "/var/run/docker.sock"
4343

4444

0 commit comments

Comments
 (0)