container_remove
Remove Docker containers by ID or name to free up system resources and manage container lifecycle. Use the force option to stop running containers before removal.
Instructions
Remove a container
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| container | Yes | Container ID or name | |
| force | No | Force remove running container |
Implementation Reference
- src/services/docker.service.ts:53-55 (handler)Core implementation executing the `docker rm` command with optional force flag.async removeContainer(id: string, force = false): Promise<string> { return this.executeCommand(`rm ${force ? '-f' : ''} ${id}`); }
- src/servers/mcp.server.ts:265-274 (handler)MCP server request handler for 'container_remove' tool, dispatching to DockerService.case 'container_remove': { const { container, force } = request.params.arguments as { container: string; force?: boolean; }; const output = await this.dockerService.removeContainer(container, force); return { content: [{ type: 'text', text: `Container removed: ${output}` }], }; }
- src/servers/mcp.server.ts:159-176 (registration)Tool registration in ListTools response, including input schema definition.{ name: 'container_remove', description: 'Remove a container', inputSchema: { type: 'object', properties: { container: { type: 'string', description: 'Container ID or name', }, force: { type: 'boolean', description: 'Force remove running container', }, }, required: ['container'], }, },