MCP Configs2026年4月8日·1 分钟阅读

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.

Agent 就绪

这个资产会安全暂存

这个资产会先安全暂存。复制的指令会要求 Agent 读取暂存文件,并在激活脚本、MCP 配置或全局配置前先确认。

Stage only · 17/100策略:需暂存
Agent 入口
任意 MCP/CLI Agent
类型
Mcp Config
安装
Stage only
信任
信任等级:Established
入口
Docker MCP — Container Management for AI Agents
安全暂存命令
npx -y tokrepo@latest install a2214d04-c235-4aad-8d6b-b27888d08547 --target codex

先暂存文件;激活前需要读取暂存 README 和安装计划。

TL;DR
Docker MCP lets AI agents build, run, stop, and inspect Docker containers through the Model Context Protocol.
§01

What it is

Docker MCP is a Model Context Protocol server that gives AI agents direct access to Docker container operations. Through MCP tool calls, an agent can list running containers, start and stop services, inspect container logs, build images, and manage Docker networks and volumes.

This server is for developers who want their AI coding assistant to manage Docker environments without switching to a terminal. It is useful for debugging containerized applications, spinning up development databases, and automating container lifecycle tasks.

§02

How it saves time or tokens

Instead of copying Docker commands between your terminal and AI chat, the agent executes Docker operations directly. It can inspect a failing container's logs, identify the issue, and suggest fixes in one conversation turn. The workflow provides the MCP configuration JSON for immediate setup.

§03

How to use

  1. Add the Docker MCP server to your .mcp.json:
{
  "mcpServers": {
    "docker": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-docker"]
    }
  }
}
  1. Restart your MCP-compatible client (Claude Code, Cursor, etc.).
  1. Ask the agent to manage containers:
'List all running containers'
'Show logs from the postgres container'
'Build and run the Dockerfile in this directory'
'Stop all containers and clean up unused images'
§04

Example

{
  "mcpServers": {
    "docker": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-docker"]
    }
  }
}

With this config, the agent can run operations like:

# Agent executes these via MCP tool calls:
docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'
docker logs --tail 50 my-api-server
docker build -t my-app:latest .
docker run -d --name my-app -p 3000:3000 my-app:latest
§05

Related on TokRepo

§06

Common pitfalls

  • The Docker daemon must be running on your machine. The MCP server connects to the local Docker socket and fails silently if Docker Desktop or dockerd is not started.
  • Giving the agent Docker access means it can stop or remove containers. Be cautious in environments with production containers running alongside development ones.
  • Building large images through the MCP server may time out with default settings. For complex builds, run them directly in the terminal.

常见问题

What Docker operations can the agent perform?+

The agent can list, start, stop, and remove containers. It can also build images, view logs, inspect container details, manage networks and volumes, and execute commands inside running containers.

Does this require Docker Desktop?+

You need a running Docker daemon. Docker Desktop provides this on macOS and Windows. On Linux, the Docker Engine (dockerd) is sufficient. The MCP server communicates through the standard Docker socket.

Is it safe to give AI agents Docker access?+

Use caution. The agent has the same Docker permissions as your user. It can stop containers, remove images, and create new ones. Avoid using it in environments where production containers share the same Docker daemon.

Can the agent work with Docker Compose?+

The MCP server exposes Docker Engine API operations. For Compose-specific commands (docker compose up/down), the agent would need to execute shell commands. Basic container operations work directly through MCP tools.

Does this work on remote Docker hosts?+

By default it connects to the local Docker socket. To connect to a remote host, you would need to configure the DOCKER_HOST environment variable in the MCP server configuration.

引用来源 (3)
🙏

来源与感谢

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产