Skip to main content
Glama

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
NameRequiredDescriptionDefault
containerYesContainer ID or name
forceNoForce remove running container

Implementation Reference

  • 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}`); }
  • 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}` }], }; }
  • 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'], }, },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Toowiredd/chatgpt-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server