🐳 Docker Mcp
概覽
什麼是 Docker MCP?
Docker MCP(模型上下文協議)是一個旨在促進容器化應用程序管理和編排的伺服器。它提供了一種標準化的方式來處理模型上下文,使開發人員能夠有效地使用 Docker 容器部署、管理和擴展他們的應用程序。Docker MCP 對於希望簡化開發流程並改善不同環境之間協作的團隊特別有用。
Docker MCP 的特點
- 容器管理:Docker MCP 簡化了容器的管理,使得用戶能夠輕鬆地部署、更新和擴展應用程序。
- 標準化協議:它利用標準化的模型上下文協議,確保與各種工具和服務的兼容性和易於集成。
- 可擴展性:Docker MCP 的架構允許應用程序無縫擴展,能夠在不妥協性能的情況下應對增加的負載。
- 用戶友好的界面:Docker MCP 提供了一個直觀的界面,使開發人員能夠輕鬆地與他們的容器化應用程序互動。
- 開源:作為一個開源項目,Docker MCP 鼓勵社區貢獻和合作,促進創新和持續改進。
如何使用 Docker MCP
- 安裝:首先在你的機器上安裝 Docker。請按照官方 Docker 文檔中的安裝說明進行操作。
- 克隆庫:使用 Git 從 GitHub 克隆 Docker MCP 倉庫:
git clone https://github.com/QuantGeekDev/docker-mcp.git
- 配置:導航到克隆的目錄,根據你的項目需求在配置文件中配置必要的設置。
- 啟動伺服器:使用 Docker 命令啟動 Docker MCP 伺服器。確保滿足所有依賴項並正確設置環境。
- 部署應用程序:使用 Docker MCP 界面部署你的應用程序,管理容器並監控性能。
- 擴展:隨著你的應用程序增長,利用 Docker MCP 的擴展功能來處理增加的流量和資源需求。
常見問題解答
Q1:Docker MCP 的系統要求是什麼?
A1:Docker MCP 需要一台安裝了 Docker 的機器。建議至少擁有 4GB 的 RAM 和多核處理器以獲得最佳性能。
Q2:Docker MCP 適合生產環境嗎?
A2:是的,Docker MCP 設計堅固且可擴展,適合生產環境。然而,建議在部署之前進行徹底測試。
Q3:我可以為 Docker MCP 做貢獻嗎?
A3:當然可以!Docker MCP 是一個開源項目,歡迎貢獻。你可以在 GitHub 倉庫上提交問題、功能請求或拉取請求。
Q4:Docker MCP 與其他容器編排工具相比如何?
A4:Docker MCP 專注於模型上下文管理,並提供用戶友好的界面,使開發人員更容易管理他們的應用程序,相比某些更複雜的編排工具更為簡便。
Q5:我可以在哪裡找到 Docker MCP 的文檔?
A5:Docker MCP 的文檔可以在倉庫的 README 文件中找到,並且還有其他資源鏈接在倉庫內。
詳細
🐳 docker-mcp
A powerful Model Context Protocol (MCP) server for Docker operations, enabling seamless container and compose stack management through Claude AI.
✨ Features
- 🚀 Container creation and instantiation
- 📦 Docker Compose stack deployment
- 🔍 Container logs retrieval
- 📊 Container listing and status monitoring
🎬 Demos
Deploying a Docker Compose Stack
https://github.com/user-attachments/assets/b5f6e40a-542b-4a39-ba12-7fdf803ee278
Analyzing Container Logs
https://github.com/user-attachments/assets/da386eea-2fab-4835-82ae-896de955d934
🚀 Quickstart
To try this in Claude Desktop app, add this to your claude config files:
{
"mcpServers": {
"docker-mcp": {
"command": "uvx",
"args": [
"docker-mcp"
]
}
}
}
Installing via Smithery
To install Docker MCP for Claude Desktop automatically via Smithery:
npx @smithery/cli install docker-mcp --client claude
Prerequisites
- UV (package manager)
- Python 3.12+
- Docker Desktop or Docker Engine
- Claude Desktop
Installation
Claude Desktop Configuration
Add the server configuration to your Claude Desktop config file:
MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"docker-mcp": {
"command": "uv",
"args": [
"--directory",
"<path-to-docker-mcp>",
"run",
"docker-mcp"
]
}
}
}
</details>
<details>
<summary>🚀 Production Configuration</summary>
{
"mcpServers": {
"docker-mcp": {
"command": "uvx",
"args": [
"docker-mcp"
]
}
}
}
</details>
🛠️ Development
Local Setup
- Clone the repository:
git clone https://github.com/QuantGeekDev/docker-mcp.git
cd docker-mcp
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
uv sync
🔍 Debugging
Launch the MCP Inspector for debugging:
npx @modelcontextprotocol/inspector uv --directory <path-to-docker-mcp> run docker-mcp
The Inspector will provide a URL to access the debugging interface.
📝 Available Tools
The server provides the following tools:
create-container
Creates a standalone Docker container
{
"image": "image-name",
"name": "container-name",
"ports": {"80": "80"},
"environment": {"ENV_VAR": "value"}
}
deploy-compose
Deploys a Docker Compose stack
{
"project_name": "example-stack",
"compose_yaml": "version: '3.8'\nservices:\n service1:\n image: image1:latest\n ports:\n - '8080:80'"
}
get-logs
Retrieves logs from a specific container
{
"container_name": "my-container"
}
list-containers
Lists all Docker containers
{}
🚧 Current Limitations
- No built-in environment variable support for containers
- No volume management
- No network management
- No container health checks
- No container restart policies
- No container resource limits
🤝 Contributing
- Fork the repository from docker-mcp
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
📜 License
This project is licensed under the MIT License - see the LICENSE file for details.
✨ Authors
- Alex Andru - Initial work | Core contributor - @QuantGeekDev
- Ali Sadykov - Initial work | Core contributor - @md-archive
Made with ❤️
伺服器配置
{
"mcpServers": {
"docker-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"ghcr.io/metorial/mcp-container--quantgeekdev--docker-mcp--docker-mcp",
"docker-mcp"
],
"env": {}
}
}
}