# Docker MCP — Container Management for AI Agents > MCP server that gives AI agents Docker container management capabilities. Build, run, stop, and inspect containers through tool calls for automated DevOps workflows. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use ```json { "mcpServers": { "docker": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-docker"] } } } ``` Now ask your AI agent: ``` "List all running containers" "Start a PostgreSQL container on port 5432" "Show logs for the api container" "Build the Dockerfile in ./backend and run it" ``` ## What is Docker MCP? Docker MCP is a Model Context Protocol server that gives AI agents structured access to Docker. Instead of running raw `docker` CLI commands, agents use typed tools for container lifecycle management — list, run, stop, remove, inspect, logs, and build. This enables AI-driven DevOps workflows where agents manage infrastructure autonomously. **Answer-Ready**: Docker MCP gives AI agents container management via MCP tools. List, run, stop, inspect, build, and read logs through structured tool calls. Enables AI-driven DevOps and automated container workflows. Works with Claude Code and Cursor. **Best for**: AI agents managing Docker containers for dev/test/deploy. **Works with**: Claude Code, Cursor, Claude Desktop. **Setup time**: Under 1 minute. ## Core Tools ### Container Management | Tool | What It Does | |------|-------------| | list_containers | List running/all containers | | run_container | Start a new container | | stop_container | Stop a running container | | remove_container | Delete a container | | inspect_container | Get container details | | container_logs | Read container output logs | ### Image Management | Tool | What It Does | |------|-------------| | list_images | List available images | | pull_image | Download an image | | build_image | Build from Dockerfile | | remove_image | Delete an image | ### System | Tool | What It Does | |------|-------------| | docker_info | System-wide Docker info | | docker_compose_up | Start compose services | | docker_compose_down | Stop compose services | ## Use Cases | Use Case | Example | |----------|---------| | Dev Environment | "Spin up PostgreSQL and Redis for local dev" | | Testing | "Build and run the test suite in a container" | | Debugging | "Show me the last 100 lines of the API container logs" | | Cleanup | "Remove all stopped containers and dangling images" | | Deployment | "Build the Dockerfile and push to registry" | ## FAQ **Q: Is it safe to give AI agents Docker access?** A: Use with caution in production. For dev/test, it is very useful. Consider restricting to read-only operations in sensitive environments. **Q: Does it support Docker Compose?** A: Yes, includes compose up/down tools for multi-container orchestration. **Q: Can it build images?** A: Yes, the build_image tool accepts a Dockerfile path and build context. ## Source & Thanks > Part of the [Model Context Protocol Servers](https://github.com/modelcontextprotocol/servers) collection. > > Docker MCP — Container management for AI agents ## 快速使用 ```json {"mcpServers": {"docker": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-docker"]}}} ``` 让 AI Agent 管理 Docker 容器。 ## 什么是 Docker MCP? MCP 服务器,AI Agent 通过工具调用管理 Docker 容器生命周期。 **一句话总结**:Docker MCP 服务器,AI Agent 通过工具管理容器(列出/运行/停止/日志/构建),AI 驱动的 DevOps 工作流。 ## 核心工具 容器:list/run/stop/remove/inspect/logs 镜像:list/pull/build/remove Compose:up/down ## 常见问题 **Q: 安全吗?** A: 开发测试环境非常有用,生产环境建议限制只读。 ## 来源与致谢 > [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) --- Source: https://tokrepo.com/en/workflows/a2214d04-c235-4aad-8d6b-b27888d08547 Author: MCP Hub