NativeAIHub
Docker MCP Gateway

Docker MCP Gateway

Manage Docker containers, images, and networks via the official Docker MCP gateway.

MCP Serverยท3 sectionsยท1 min read
devopscoding
Install Prompt

Paste this into Claude Code to set it up:

I want to add the Docker MCP Gateway to my Claude Code setup.

IMPORTANT: Never use Read/Edit tools on ~/.claude.json. Use jq via Bash instead.

Prerequisites: Docker Desktop must be installed and running. The MCP gateway is built into Docker Desktop (version 4.37+).

Run this command to add the MCP server:
```bash
jq '.mcpServers["docker"] = {"type": "stdio", "command": "docker", "args": ["mcp", "gateway", "stdio"]}' ~/.claude.json > /tmp/claude-json-tmp && mv /tmp/claude-json-tmp ~/.claude.json
```

After adding, restart Claude Code. The server connects to your local Docker daemon and gives the agent control over containers, images, volumes, and networks.

01What It Does

Docker operations without context switching

The Docker MCP Gateway connects your AI agent directly to the Docker daemon. Instead of writing docker CLI commands manually, the agent can list running containers, inspect logs, manage images, and control networks. This is particularly useful when debugging containerized applications or managing local development environments.
๐Ÿณ
Container ManagementList, start, stop, restart, and remove containers. Inspect container details, read logs, and exec into running containers.
๐Ÿ’พ
Image and Volume ControlPull, list, and remove images. Manage volumes for persistent data. Clean up unused resources to free disk space.
๐ŸŒ
Network OperationsCreate and manage Docker networks. Connect containers to networks, inspect network configurations, and troubleshoot connectivity.

02Setup

# Add to ~/.claude.json under mcpServers
"docker": {
  "type": "stdio",
  "command": "docker",
  "args": ["mcp", "gateway", "stdio"]
}
Docker Desktop must be running before starting Claude Code. The MCP gateway feature requires Docker Desktop version 4.37 or later. If the connection fails, verify Docker Desktop is updated and the daemon is active.

03Usage Patterns

๐Ÿ”ง
Debug Containerized AppsAsk the agent to check container logs, inspect environment variables, and verify port mappings when something is not working as expected.
๐Ÿงน
Environment CleanupHave the agent identify and remove unused containers, dangling images, and orphan volumes to reclaim disk space.