Docker MCP Server
Manage Docker containers, images, networks, and volumes through AI assistants using natural language with the Docker MCP Server.
Overview
The Docker MCP Server enables AI assistants to manage Docker directly through natural language. It provides 20 tools for controlling containers, images, networks, and volumes, plus a docker_compose prompt for deploying multi-container applications. The server connects to any Docker daemon — local or remote over SSH — making it suitable for development, server administration, and experimentation.
Community Server:
Developed by ckreiling with 710+ stars on GitHub. Python-based, installed via uv or pip.
Key Features
Container Management
Create, start, stop, remove, and recreate containers. Run containers with custom images and configurations.
Container Introspection
Fetch container logs, view CPU/memory stats, and inspect running containers in real-time.
Docker Compose
Deploy multi-container applications using natural language with the docker_compose plan+apply loop.
Remote Docker Support
Connect to remote Docker daemons over SSH for managing servers and cloud infrastructure.
Image Operations
List, pull, push, build, and remove Docker images directly from AI conversations.
Volume & Network Management
Create and manage Docker volumes for persistent data and networks for container communication.
Available Tools
Quick Reference
| Tool | Purpose | Category |
|---|---|---|
list_containers | List all containers | Containers |
create_container | Create a new container | Containers |
run_container | Create and start a container | Containers |
recreate_container | Recreate an existing container | Containers |
start_container | Start a stopped container | Containers |
stop_container | Stop a running container | Containers |
remove_container | Remove a container | Containers |
fetch_container_logs | Get container logs | Containers |
list_images | List available images | Images |
pull_image | Pull an image from registry | Images |
push_image | Push an image to registry | Images |
build_image | Build an image from source | Images |
remove_image | Remove an image | Images |
list_networks | List Docker networks | Networks |
create_network | Create a network | Networks |
remove_network | Remove a network | Networks |
list_volumes | List Docker volumes | Volumes |
create_volume | Create a volume | Volumes |
remove_volume | Remove a volume | Volumes |
Detailed Usage
run_container▶
Create and start a container with the specified image and configuration.
use_mcp_tool({
server_name: "mcp-server-docker",
tool_name: "run_container",
arguments: {
image: "nginx:latest",
name: "my-nginx",
ports: { "80/tcp": 8080 },
env: { NGINX_HOST: "localhost" }
}
});
fetch_container_logs▶
Fetch logs from a running or stopped container.
use_mcp_tool({
server_name: "mcp-server-docker",
tool_name: "fetch_container_logs",
arguments: {
container: "my-nginx",
tail: 50
}
});
build_image▶
Build a Docker image from a Dockerfile or URL.
use_mcp_tool({
server_name: "mcp-server-docker",
tool_name: "build_image",
arguments: {
path: "/path/to/dockerfile",
tag: "my-app:latest"
}
});
create_volume▶
Create a Docker volume for persistent data storage.
use_mcp_tool({
server_name: "mcp-server-docker",
tool_name: "create_volume",
arguments: {
name: "my-data",
driver: "local"
}
});
Prompts
The server includes a docker_compose prompt that uses a plan+apply loop for deploying multi-container applications:
docker_compose: Use natural language to compose containers.
Provide a Project Name and a description of desired containers.
The LLM will present a plan for your approval before executing.
Example: "deploy a WordPress container and a supporting MySQL container, exposing WordPress on port 9000"
Installation
{
"mcpServers": {
"mcp-server-docker": {
"command": "uvx",
"args": [
"mcp-server-docker"
]
}
}
}
Docker Socket:
Mounting /var/run/docker.sock gives the MCP server access to your local Docker daemon. For remote connections, set the DOCKER_HOST environment variable to an SSH URL (e.g. ssh://user@host).
Configuration
The server uses the Python Docker SDK's from_env method. Connect to a remote Docker daemon over SSH by setting the DOCKER_HOST environment variable:
{
"mcpServers": {
"mcp-server-docker": {
"command": "uvx",
"args": ["mcp-server-docker"],
"env": {
"DOCKER_HOST": "ssh://[email protected]"
}
}
}
}
Security:
This MCP server has full control over Docker on the host machine. Do not configure containers with sensitive data like API keys or passwords. The server intentionally blocks dangerous options like --privileged and --cap-add/--cap-drop.
Common Use Cases
- Development Environments: Spin up and tear down development containers with natural language
- Server Administration: Deploy and manage containers on remote servers via SSH
- Application Debugging: Fetch logs, inspect container stats, and debug running applications
- Multi-Container Deployments: Use the compose prompt to deploy WordPress + MySQL or similar stacks
- Image Management: Build, pull, push, and manage Docker images across registries
Sources
Related Articles
ServiceNow MCP Server
ServiceNow MCP server enables AI models to interact with ServiceNow instances, providing capabilities for IT service management, incident tracking, workflow automation, and knowledge base management through natural language.
PostgreSQL MCP Server
PostgreSQL MCP servers enable AI models to interact with PostgreSQL databases, providing capabilities for structured data operations, SQL queries, transaction management, and advanced data indexing.
Terminal MCP Server
Terminal MCP servers enable AI models to interact with command-line interfaces and shells, providing capabilities for executing commands, managing processes, file operations, and handling terminal I/O in a secure environment.