MCPcopy
hub / github.com/coder/mux / getContainerName

Function getContainerName

src/node/runtime/DockerRuntime.ts:284–293  ·  view source on GitHub ↗
(projectPath: string, workspaceName: string)

Source from the content-addressed store, hash-verified

282 * Hash suffix prevents collisions (e.g., feature/foo vs feature-foo)
283 */
284export function getContainerName(projectPath: string, workspaceName: string): string {
285 const projectName = getProjectName(projectPath);
286 const hash = createHash("sha256")
287 .update(`${projectPath}:${workspaceName}`)
288 .digest("hex")
289 .slice(0, 6);
290 // Reserve 7 chars for "-{hash}", leaving 56 for base
291 const base = sanitizeContainerName(`mux-${projectName}-${workspaceName}`).slice(0, 56);
292 return `${base}-${hash}`;
293}
294
295/**
296 * Docker runtime implementation that executes commands inside Docker containers.

Callers 9

createRuntimeFunction · 0.90
fork.test.tsFile · 0.90
createWorkspaceMethod · 0.85
deleteWorkspaceMethod · 0.85
forkWorkspaceMethod · 0.85
runtime.test.tsFile · 0.85

Calls 3

getProjectNameFunction · 0.90
sanitizeContainerNameFunction · 0.85
updateMethod · 0.65

Tested by

no test coverage detected