MCPcopy Create free account
hub / github.com/FastLED/FastLED / find_docker_executable

Function find_docker_executable

ci/util/docker_command.py:20–56  ·  view source on GitHub ↗

Find the docker executable on the system. Returns: Path to docker executable, or None if not found

()

Source from the content-addressed store, hash-verified

18
19
20def find_docker_executable() -> Optional[str]:
21 """Find the docker executable on the system.
22
23 Returns:
24 Path to docker executable, or None if not found
25 """
26 global _docker_executable_cache
27
28 if _docker_executable_cache is not None:
29 return _docker_executable_cache
30
31 # Check if docker command is available
32 try:
33 result = RunningProcess.run(
34 ["docker", "--version"],
35 cwd=None,
36 check=False,
37 timeout=5,
38 )
39 if result.returncode == 0:
40 _docker_executable_cache = "docker"
41 return "docker"
42 except (FileNotFoundError, RuntimeError):
43 pass
44
45 # On Windows, try to find docker.exe in common locations
46 if sys.platform == "win32":
47 common_paths = [
48 r"C:\Program Files\Docker\Docker\resources\bin\docker.exe",
49 r"C:\Program Files\Docker\Docker\docker.exe",
50 ]
51 for path in common_paths:
52 if os.path.exists(path):
53 _docker_executable_cache = path
54 return path
55
56 return None
57
58
59def get_docker_command() -> str:

Callers 2

is_docker_installedFunction · 0.90
get_docker_commandFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected