Get the FREE Ultimate OpenClaw Setup Guide →

mcp -docker

MCP server for Docker

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio ckreiling-mcp-server-docker docker run -i --rm -v /var/run/docker.sock:/var/run/docker.sock mcp-server-docker:latest \
  --env DOCKER_HOST="description or placeholder"

How to use

This MCP server provides a natural language interface to manage Docker directly from an LLM. It lets you compose containers from plain language, inspect running containers, and manage persistent data via Docker volumes, networks, and images. You can use the docker_compose prompt to describe a project, specify the containers you want, and let the system generate a plan and apply it in stages. You’ll have access to resources for each container (stats and logs) and actions to list, create, start, stop, and remove containers, images, networks, and volumes. For remote setups, you can point the server at a Docker daemon over SSH by configuring DOCKER_HOST, enabling you to administer remote engines securely.

How to install

Prerequisites:

  • Docker installed on the host where you run the MCP server
  • Access to the repository containing the MCP server
  • Optional: uv/uvx if you prefer an alternative installation path

Option A: Install using Docker (recommended for this MCP server)

  1. Build the Docker image after cloning the repository:
docker build -t mcp-server-docker .
  1. Run the MCP server using Docker and mount the Docker socket so it can control the local daemon:
"mcpServers": {
  "mcp-server-docker": {
    "command": "docker",
    "args": [
      "run",
      "-i",
      "--rm",
      "-v",
      "/var/run/docker.sock:/var/run/docker.sock",
      "mcp-server-docker:latest"
    ]
  }
}

Option B: Install using uvx (Python) (if you prefer running via uv/uvx)

  1. Install uv and uvx following the project’s guidance (see linked install instructions in the README).
  2. In your MCP servers file, configure the server as:
"mcpServers": {
  "mcp-server-docker": {
    "command": "uvx",
    "args": [
      "mcp-server-docker"
    ]
  }
}

Note: When using the Docker route, you mount the Docker socket to let the MCP server communicate with the local Docker daemon. Ensure the user running Docker has the necessary permissions.

Additional notes

Tips and caveats:

  • Do not configure containers with sensitive data in the LLM prompts. Use secrets management or environment variable injection where necessary.
  • The server supports SSH-based Docker daemons via DOCKER_HOST. Example: "env": { "DOCKER_HOST": "ssh://myuser@myhost.example.com" }
  • For safety, the MCP server disables potentially dangerous Docker options (e.g., --privileged, --cap-add/--cap-drop). If you need advanced capabilities, file an issue.
  • Review containers, volumes, and networks created by the LLM to prevent resource bloat or security issues.
  • If you’re running via Docker, ensure the MCP image has access to the Docker socket and that the socket path matches your host setup.
  • Development workflow: you can use the provided prompts (e.g., docker_compose) to iteratively plan and apply container changes.

Related MCP Servers

Sponsor this space

Reach thousands of developers