Skip to main content
Glama

docker_compose

Manage Docker Compose services to start, stop, monitor, and control multi-container applications through the Docker MCP Server.

Instructions

Manage Docker Compose services

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesDocker Compose action to perform
serviceNoSpecific service name (optional)
detachNoRun in detached mode
buildNoBuild images before starting (for up action)

Implementation Reference

  • src/index.ts:1816-1876 (registration)
    Registration of the 'docker_compose' MCP tool, including schema and inline handler function.
    server.registerTool( "docker_compose", { title: "Docker Compose Management", description: "Manage Docker Compose services", inputSchema: { action: z.enum(["up", "down", "logs", "ps", "restart", "build"]).describe("Docker Compose action to perform"), service: z.string().optional().describe("Specific service name (optional)"), detach: z.boolean().optional().default(true).describe("Run in detached mode"), build: z.boolean().optional().describe("Build images before starting (for up action)") } }, async ({ action, service, detach, build }) => { try { let command: string; const serviceArg = service ? ` ${service}` : ""; switch (action) { case "up": command = `docker-compose up${detach ? " -d" : ""}${build ? " --build" : ""}${serviceArg}`; break; case "down": command = `docker-compose down${serviceArg}`; break; case "logs": command = `docker-compose logs${serviceArg}`; break; case "ps": command = "docker-compose ps"; break; case "restart": command = `docker-compose restart${serviceArg}`; break; case "build": command = `docker-compose build${serviceArg}`; break; } const result = await executeDockerCommand(command); return { content: [ { type: "text", text: `Docker Compose ${action} completed:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error with Docker Compose: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );
  • The handler function that constructs and executes docker-compose commands based on the input action (up, down, logs, ps, restart, build). Uses the shared executeDockerCommand helper.
    async ({ action, service, detach, build }) => { try { let command: string; const serviceArg = service ? ` ${service}` : ""; switch (action) { case "up": command = `docker-compose up${detach ? " -d" : ""}${build ? " --build" : ""}${serviceArg}`; break; case "down": command = `docker-compose down${serviceArg}`; break; case "logs": command = `docker-compose logs${serviceArg}`; break; case "ps": command = "docker-compose ps"; break; case "restart": command = `docker-compose restart${serviceArg}`; break; case "build": command = `docker-compose build${serviceArg}`; break; } const result = await executeDockerCommand(command); return { content: [ { type: "text", text: `Docker Compose ${action} completed:\n\n${result.stdout}${result.stderr ? `\nWarnings:\n${result.stderr}` : ""}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error with Docker Compose: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
  • The input schema defining parameters for the docker_compose tool: action (required enum), optional service, detach, and build flags.
    { title: "Docker Compose Management", description: "Manage Docker Compose services", inputSchema: { action: z.enum(["up", "down", "logs", "ps", "restart", "build"]).describe("Docker Compose action to perform"), service: z.string().optional().describe("Specific service name (optional)"), detach: z.boolean().optional().default(true).describe("Run in detached mode"), build: z.boolean().optional().describe("Build images before starting (for up action)") }

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/TauqeerAhmad5201/docker-mcp-extension'

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