We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 632e5f4 commit 42bb736Copy full SHA for 42bb736
core/testcontainers/core/config.py
@@ -33,13 +33,17 @@ def get_docker_socket() -> str:
33
if socket_path := environ.get("TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE"):
34
return socket_path
35
36
- client = docker.from_env()
+ default_socket_address: str = "/var/run/docker.sock"
37
+ try:
38
+ client = docker.from_env()
39
+ except docker.errors.DockerException:
40
+ return default_socket_address
41
try:
42
socket_path = client.api.get_adapter(client.api.base_url).socket_path
43
# return the normalized path as string
44
return str(Path(socket_path).absolute())
45
except AttributeError:
- return "/var/run/docker.sock"
46
47
48
49
MAX_TRIES = int(environ.get("TC_MAX_TRIES", 120))
0 commit comments