Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYesContainer ID or name

Implementation Reference

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

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/ofershap/mcp-server-docker'

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