MCPcopy Create free account
hub / github.com/ShipSecAI/studio / resolveDockerPath

Function resolveDockerPath

packages/component-sdk/src/runner.ts:18–43  ·  view source on GitHub ↗
(context?: ExecutionContext)

Source from the content-addressed store, hash-verified

16let cachedDockerPath: string | null = null;
17
18export async function resolveDockerPath(context?: ExecutionContext): Promise<string> {
19 if (cachedDockerPath) return cachedDockerPath;
20
21 const commonPaths = [
22 '/usr/local/bin/docker',
23 '/opt/homebrew/bin/docker',
24 '/usr/bin/docker',
25 '/bin/docker',
26 ];
27
28 for (const path of commonPaths) {
29 try {
30 await access(path, constants.X_OK);
31 context?.logger.debug(`[Docker] Resolved docker path to: ${path}`);
32 cachedDockerPath = path;
33 return path;
34 } catch {
35 // Continue to next path
36 }
37 }
38
39 // Fallback to searching in PATH
40 context?.logger.info(`[Docker] Checked common paths but could not find docker. Fallback to using "docker" from PATH.`);
41 cachedDockerPath = 'docker';
42 return 'docker';
43}
44
45
46

Callers 4

listVolumeFilesFunction · 0.90
setVolumeOwnershipFunction · 0.90
runDockerWithStandardIOFunction · 0.85
runDockerWithPtyFunction · 0.85

Calls 2

debugMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected