stop_container
Stop a running Docker container by specifying its ID or name to halt processes and free system resources.
Instructions
Stop a running Docker container.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Container ID or name |
Implementation Reference
- src/docker.ts:79-83 (handler)The core handler function that executes the Docker container stop operation using Dockerode API. It gets the container by ID and calls the stop() method.
export async function stopContainer(id: string): Promise<string> { const container = docker.getContainer(id); await container.stop(); return `Container ${id} stopped`; } - src/index.ts:80-88 (registration)MCP tool registration for 'stop_container' with description, input schema using Zod, and handler that delegates to the stopContainer function.
server.tool( "stop_container", "Stop a running Docker container.", { id: z.string().describe("Container ID or name") }, async ({ id }) => { const result = await stopContainer(id); return { content: [{ type: "text", text: result }] }; }, ); - src/index.ts:83-83 (schema)Zod schema defining the input parameter 'id' as a required string with description for the stop_container tool.
{ id: z.string().describe("Container ID or name") },