An MCP server for managing Docker with natural language! - ๐ Compose containers with natural language - ๐ Introspect & debug running containers - ๐ Manage persistent data with Docker volumes - Server administrators: connect to remote Docker engines for e.g. managing a public-facing website. - Tinkerers: run containers locally and experiment with open-source apps supporting Docker. - AI enthusia
Add this skill
npx mdskills install ckreiling/mcp-server-dockerComprehensive Docker control via MCP with extensive tools, prompts, and remote SSH support
1# ๐ Docker MCP server23An MCP server for managing Docker with natural language!45## ๐ชฉ What can it do?67- ๐ Compose containers with natural language8- ๐ Introspect & debug running containers9- ๐ Manage persistent data with Docker volumes1011## โ Who is this for?1213- Server administrators: connect to remote Docker engines for e.g. managing a14 public-facing website.15- Tinkerers: run containers locally and experiment with open-source apps16 supporting Docker.17- AI enthusiasts: push the limits of that an LLM is capable of!1819## Demo2021A quick demo showing a WordPress deployment using natural language:2223https://github.com/user-attachments/assets/65e35e67-bce0-4449-af7e-9f4dd773b4b32425## ๐๏ธ Quickstart2627### Install2829#### Claude Desktop3031On MacOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json`3233On Windows: `%APPDATA%/Claude/claude_desktop_config.json`3435<details>36 <summary>Install from PyPi with uv</summary>3738If you don't have `uv` installed, follow the installation instructions for your39system:40[link](https://docs.astral.sh/uv/getting-started/installation/#installation-methods)4142Then add the following to your MCP servers file:4344```45"mcpServers": {46 "mcp-server-docker": {47 "command": "uvx",48 "args": [49 "mcp-server-docker"50 ]51 }52}53```5455</details>5657<details>58 <summary>Install with Docker</summary>5960Purely for convenience, the server can run in a Docker container.6162After cloning this repository, build the Docker image:6364```bash65docker build -t mcp-server-docker .66```6768And then add the following to your MCP servers file:6970```71"mcpServers": {72 "mcp-server-docker": {73 "command": "docker",74 "args": [75 "run",76 "-i",77 "--rm",78 "-v",79 "/var/run/docker.sock:/var/run/docker.sock",80 "mcp-server-docker:latest"81 ]82 }83}84```8586Note that we mount the Docker socket as a volume; this ensures the MCP server87can connect to and control the local Docker daemon.8889</details>9091## ๐ Prompts9293### ๐ป `docker_compose`9495Use natural language to compose containers. [See above](#demo) for a demo.9697Provide a Project Name, and a description of desired containers, and let the LLM98do the rest.99100This prompt instructs the LLM to enter a `plan+apply` loop. Your interaction101with the LLM will involve the following steps:1021031. You give the LLM instructions for which containers to bring up1042. The LLM calculates a concise natural language plan and presents it to you1053. You either:106 - Apply the plan107 - Provide the LLM feedback, and the LLM recalculates the plan108109#### Examples110111- name: `nginx`, containers: "deploy an nginx container exposing it on port112 9000"113- name: `wordpress`, containers: "deploy a WordPress container and a supporting114 MySQL container, exposing Wordpress on port 9000"115116#### Resuming a Project117118When starting a new chat with this prompt, the LLM will receive the status of119any containers, volumes, and networks created with the given project `name`.120121This is mainly useful for cleaning up, in-case you lose a chat that was122responsible for many containers.123124## ๐ Resources125126The server implements a couple resources for every container:127128- Stats: CPU, memory, etc. for a container129- Logs: tail some logs from a container130131## ๐จ Tools132133### Containers134135- `list_containers`136- `create_container`137- `run_container`138- `recreate_container`139- `start_container`140- `fetch_container_logs`141- `stop_container`142- `remove_container`143144### Images145146- `list_images`147- `pull_image`148- `push_image`149- `build_image`150- `remove_image`151152### Networks153154- `list_networks`155- `create_network`156- `remove_network`157158### Volumes159160- `list_volumes`161- `create_volume`162- `remove_volume`163164## ๐ง Disclaimers165166### Sensitive Data167168**DO NOT CONFIGURE CONTAINERS WITH SENSITIVE DATA.** This includes API keys,169database passwords, etc.170171Any sensitive data exchanged with the LLM is inherently compromised, unless the172LLM is running on your local machine.173174If you are interested in securely passing secrets to containers, file an issue175on this repository with your use-case.176177### Reviewing Created Containers178179Be careful to review the containers that the LLM creates. Docker is not a secure180sandbox, and therefore the MCP server can potentially impact the host machine181through Docker.182183For safety reasons, this MCP server doesn't support sensitive Docker options184like `--privileged` or `--cap-add/--cap-drop`. If these features are of interest185to you, file an issue on this repository with your use-case.186187## ๐ ๏ธ Configuration188189This server uses the Python Docker SDK's `from_env` method. For configuration190details, see191[the documentation](https://docker-py.readthedocs.io/en/stable/client.html#docker.client.from_env).192193### Connect to Docker over SSH194195This MCP server can connect to a remote Docker daemon over SSH.196197Simply set a `ssh://` host URL in the MCP server definition:198199```200"mcpServers": {201 "mcp-server-docker": {202 "command": "uvx",203 "args": [204 "mcp-server-docker"205 ],206 "env": {207 "DOCKER_HOST": "ssh://myusername@myhost.example.com"208 }209 }210}211```212213## ๐ป Development214215Prefer using Devbox to configure your development environment.216217See the `devbox.json` for helpful development commands.218219After setting up devbox you can configure your Claude MCP config to use it:220221```222 "docker": {223 "command": "/path/to/repo/.devbox/nix/profile/default/bin/uv",224 "args": [225 "--directory",226 "/path/to/repo/",227 "run",228 "mcp-server-docker"229 ]230 },231```232
Full transparency โ inspect the skill content before installing.