🐋 Docker MCP server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
An MCP server for managing Docker with natural language!
🪩 What can it do?
- 🚀 Compose containers with natural language
- 🔍 Introspect & debug running containers
- 📀 Manage persistent data with Docker volumes
❓ Who is this for?
- 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 enthusiasts: push the limits of that an LLM is capable of!
Demo
A quick demo showing a WordPress deployment using natural language:
https://github.com/user-attachments/assets/65e35e67-bce0-4449-af7e-9f4dd773b4b3
🏎️ Quickstart
Install
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
Install from PyPi with uv
If you don't have uv installed, follow the installation instructions for your
system:
link
Then add the following to your MCP servers file:
Install with Docker
Purely for convenience, the server can run in a Docker container.
After cloning this repository, build the Docker image:
And then add the following to your MCP servers file:
Note that we mount the Docker socket as a volume; this ensures the MCP server
can connect to and control the local Docker daemon.
📝 Prompts
🎻 docker_compose
Use natural language to compose containers. See above for a demo.
Provide a Project Name, and a description of desired containers, and let the LLM
do the rest.
This prompt instructs the LLM to enter a plan+apply loop. Your interaction
with the LLM will involve the following steps:
1. You give the LLM instructions for which containers to bring up
2. The LLM calculates a concise natural language plan and presents it to you
3. You either:
- Apply the plan
- Provide the LLM feedback, and the LLM recalculates the plan
Examples
- name: nginx, containers: "deploy an nginx container exposing it on port
9000"
- name: wordpress, containers: "deploy a WordPress container and a supporting
MySQL container, exposing Wordpress on port 9000"
Resuming a Project
When starting a new chat with this prompt, the LLM will receive the status of
any containers, volumes, and networks created with the given project name.
This is mainly useful for cleaning up, in-case you lose a chat that was
responsible for many containers.
📔 Resources
The server exposes resource templates rather than enumerating currently-running containers:
- docker://containers/{container_id}/logs (text/plain)
- docker://containers/{container_id}/stats (application/json)
Read either URI with a Docker container ID or name.
🔨 Tools
Containers
- list_containers
- create_container
- run_container
- recreate_container
- start_container
- fetch_container_logs
- stop_container
- remove_container
Images
- list_images
- pull_image
- push_image
- build_image
- remove_image
Networks
- list_networks
- create_network
- remove_network
Volumes
- list_volumes
- create_volume
- remove_volume