Get the FREE Ultimate OpenClaw Setup Guide →

DockerMcpServer

A Docker MCP Server built using the ModelContextProtocol NuGet package

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio jamesburton-dockermcpserver docker run -i --rm -v /var/run/docker.sock:/var/run/docker.sock ghcr.io/jamesburton/dockermcpserver:latest

How to use

DockerMCPServer exposes full Docker functionality through MCP clients (such as Claude AI, Cursor, or VS Code) by running the server in a container. It provides programmatic access to containers, images, networks, volumes, Docker Compose stacks, and system-level operations. This enables you to create, start, stop, inspect, and remove containers; manage images (pull, build, tag, push, prune); configure networks and volumes; deploy Compose stacks with environment injection; and perform advanced configurations like resource limits, DNS, mounts, and security options via your MCP client.

To use it, deploy the server (commonly via Docker as shown in the installation section) and point your MCP client’s configuration at the docker server endpoint. Through the MCP protocol, you’ll issue structured operations such as creating a container with specific image, port mappings, volumes, and environment variables; deploying a Compose stack; or querying system information and daemon version. The client will serialize these requests and the DockerMCPServer will translate them into Docker API interactions, returning results and statuses that your workflow can consume.

How to install

Prerequisites:

  • Docker (or Docker Desktop) installed on the host
  • Internet access to pull images

Option A: Run the Docker MCP Server via the official container (recommended)

  1. Pull and run the server container, mounting the Docker socket: docker run -d --name docker-mcp-server
    -v /var/run/docker.sock:/var/run/docker.sock
    ghcr.io/jamesburton/dockermcpserver:latest

  2. (Optional) Mount a config directory if you want to customize settings: docker run -d --name docker-mcp-server
    -v /var/run/docker.sock:/var/run/docker.sock
    -v $(pwd)/config:/app/config
    ghcr.io/jamesburton/dockermcpserver:latest

  3. Point your MCP client configuration at the server. Example in Claude/Desktop config: { "mcpServers": { "docker": { "command": "docker", "args": ["run", "-i", "--rm", "-v", "/var/run/docker.sock:/var/run/docker.sock", "ghcr.io/jamesburton/dockermcpserver:latest"], "env": {} } } }

Option B: Run from source (development)

  1. Clone the repo and navigate to it: git clone https://github.com/jamesburton/DockerMcpServer.git cd DockerMcpServer

  2. Ensure .NET 8 SDK is installed.

  3. Restore and run: dotnet restore dotnet run --project DockerMcpServer/DockerMcpServer.csproj

Note: When running in container mode, ensure your host has permission to access the Docker daemon (via /var/run/docker.sock) as shown above.

Additional notes

Environment considerations:

  • Ensure the Docker socket is mounted with appropriate permissions. Running as root or a user in the docker group is common.
  • If you enable advanced container features (e.g., privileged mode, custom DNS, or APPArmor/SELinux options), verify that your host security policies allow these operations.
  • For production, consider configuring TLS, access controls, and network isolation where supported by your MCP client and environment.
  • If you encounter connectivity issues between the MCP server and the Docker daemon, verify that the Docker daemon is reachable from the container (or host) and that there are no firewall rules blocking Docker API access.
  • When using Docker Compose operations, keep your Compose file versions and service definitions compatible with the server’s capabilities.

Related MCP Servers

Sponsor this space

Reach thousands of developers