MCPcopy Index your code
hub / github.com/devcontainers/cli / findExistingContainer

Function findExistingContainer

src/spec-node/singleContainer.ts:288–302  ·  view source on GitHub ↗
(params: DockerResolverParameters, labels: string[])

Source from the content-addressed store, hash-verified

286}
287
288export async function findExistingContainer(params: DockerResolverParameters, labels: string[]) {
289 const { common } = params;
290 let container = await findDevContainer(params, labels);
291 if (params.expectExistingContainer && !container) {
292 throw new ContainerError({ description: 'The expected container does not exist.' });
293 }
294 if (container && (params.removeOnStartup === true || params.removeOnStartup === container.Id)) {
295 const text = 'Removing Existing Container';
296 const start = common.output.start(text);
297 await removeContainer(params, container.Id);
298 common.output.stop(text, start);
299 container = undefined;
300 }
301 return container;
302}
303
304async function startExistingContainer(params: DockerResolverParameters, labels: string[], container: ContainerDetails) {
305 const { common } = params;

Callers 1

Calls 4

removeContainerFunction · 0.90
findDevContainerFunction · 0.85
startMethod · 0.80
stopMethod · 0.80

Tested by

no test coverage detected