Docker Integration MCP Servers
Docker MCP servers provide interfaces for LLMs to interact with Docker containers and services. These servers enable AI models to manage containers, handle image operations, and assist with Docker infrastructure tasks.
Overview
The MCP Docker Server enables AI models to interact directly with Docker through the Model Context Protocol (MCP). It provides a standardized interface for container operations, allowing AI to assist with container management, image handling, and Docker infrastructure tasks.
Official Server:
Developed and maintained by Model Context Protocol
Key Features
Container Management
Start, stop, restart, and remove Docker containers.
Image Operations
Build, pull, push, and remove Docker images.
Service Orchestration
Manage Docker services and stacks.
Volume Management
Create, inspect, and remove Docker volumes.
Tools
Quick Reference
| Tool | Purpose | Category |
|---|---|---|
list_containers | List all Docker containers | Container Management |
create_container | Create a new Docker container | Container Management |
run_container | Create and start a Docker container | Container Management |
recreate_container | Stop, remove, and run a new container | Container Management |
start_container | Start a Docker container | Container Management |
fetch_container_logs | Fetch logs from a Docker container | Container Management |
stop_container | Stop a Docker container | Container Management |
remove_container | Remove a Docker container | Container Management |
list_images | List Docker images | Image Management |
pull_image | Pull a Docker image from a registry | Image Management |
push_image | Push a Docker image to a registry | Image Management |
build_image | Build a Docker image from a Dockerfile | Image Management |
remove_image | Remove a Docker image | Image Management |
list_networks | List Docker networks | Network Management |
create_network | Create a Docker network | Network Management |
remove_network | Remove a Docker network | Network Management |
list_volumes | List Docker volumes | Volume Management |
create_volume | Create a Docker volume | Volume Management |
remove_volume | Remove a Docker volume | Volume Management |
Detailed Usage
list_containers▶
List all Docker containers.
use_mcp_tool({
server_name: "docker",
tool_name: "list_containers",
arguments: {
all: true,
filters: {
status: ["running"]
}
}
});
Returns a list of container objects.
create_container▶
Create a new Docker container without starting it.
use_mcp_tool({
server_name: "docker",
tool_name: "create_container",
arguments: {
image: "ubuntu:latest",
name: "my-ubuntu-container",
command: ["echo", "Hello from Docker"]
}
});
Returns the ID of the created container.
run_container▶
Create and start a new Docker container (preferred over create_container + start_container).
use_mcp_tool({
server_name: "docker",
tool_name: "run_container",
arguments: {
image: "nginx:latest",
name: "my-nginx-server",
ports: {"80/tcp": "8080"},
detach: true
}
});
Returns the ID of the running container.
recreate_container▶
Stop and remove a container, then run a new container.
use_mcp_tool({
server_name: "docker",
tool_name: "recreate_container",
arguments: {
container_id: "my-old-container",
image: "my-app:v2",
name: "my-new-app"
}
});
Returns the ID of the newly created and running container.
start_container▶
Start a Docker container.
use_mcp_tool({
server_name: "docker",
tool_name: "start_container",
arguments: {
container_id: "my-stopped-container"
}
});
Returns success or error.
fetch_container_logs▶
Fetch logs from a Docker container.
use_mcp_tool({
server_name: "docker",
tool_name: "fetch_container_logs",
arguments: {
container_id: "my-running-container",
tail: 100
}
});
Returns the container logs.
stop_container▶
Stop a Docker container.
use_mcp_tool({
server_name: "docker",
tool_name: "stop_container",
arguments: {
container_id: "my-running-container"
}
});
Returns success or error.
remove_container▶
Remove a Docker container.
use_mcp_tool({
server_name: "docker",
tool_name: "remove_container",
arguments: {
container_id: "my-old-container",
force: true
}
});
Returns success or error.
list_images▶
List Docker images.
use_mcp_tool({
server_name: "docker",
tool_name: "list_images",
arguments: {
filters: {
dangling: false
}
}
});
Returns a list of image objects.
pull_image▶
Pull a Docker image from a registry.
use_mcp_tool({
server_name: "docker",
tool_name: "pull_image",
arguments: {
repository: "ubuntu",
tag: "22.04"
}
});
Returns success or error.
push_image▶
Push a Docker image to a registry.
use_mcp_tool({
server_name: "docker",
tool_name: "push_image",
arguments: {
repository: "myregistry/my-app",
tag: "latest"
}
});
Returns success or error.
build_image▶
Build a Docker image from a Dockerfile.
use_mcp_tool({
server_name: "docker",
tool_name: "build_image",
arguments: {
path: ".",
dockerfile: "Dockerfile",
tag: "my-custom-image:latest"
}
});
Returns success or error.
remove_image▶
Remove a Docker image.
use_mcp_tool({
server_name: "docker",
tool_name: "remove_image",
arguments: {
image: "my-old-image:latest",
force: true
}
});
Returns success or error.
list_networks▶
List Docker networks.
use_mcp_tool({
server_name: "docker",
tool_name: "list_networks",
arguments: {
filters: {
driver: ["bridge"]
}
}
});
Returns a list of network objects.
create_network▶
Create a Docker network.
use_mcp_tool({
server_name: "docker",
tool_name: "create_network",
arguments: {
name: "my-custom-network",
driver: "bridge"
}
});
Returns the ID of the created network.
remove_network▶
Remove a Docker network.
use_mcp_tool({
server_name: "docker",
tool_name: "remove_network",
arguments: {
network_id: "my-custom-network"
}
});
Returns success or error.
list_volumes▶
List Docker volumes.
use_mcp_tool({
server_name: "docker",
tool_name: "list_volumes",
arguments: {}
});
Returns a list of volume objects.
create_volume▶
Create a Docker volume.
use_mcp_tool({
server_name: "docker",
tool_name: "create_volume",
arguments: {
name: "my-data-volume",
driver: "local"
}
});
Returns the name of the created volume.
remove_volume▶
Remove a Docker volume.
use_mcp_tool({
server_name: "docker",
tool_name: "remove_volume",
arguments: {
volume_name: "my-data-volume",
force: false
}
});
Returns success or error.
Installation
{
"mcpServers": {
"docker": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-docker"
]
}
}
}
Common Use Cases
1. Automating Container Deployments
Deploy and manage application containers programmatically:
// Deploy a new web application container
use_mcp_tool({
server_name: "docker",
tool_name: "run_container",
arguments: {
image: "my-webapp:latest",
name: "my-webapp-instance",
ports: {"80/tcp": "8080"},
detach: true
}
});
2. Managing Development Environments
Spin up and tear down isolated development environments:
// Start a development database container
use_mcp_tool({
server_name: "docker",
tool_name: "run_container",
arguments: {
image: "postgres:13",
name: "dev-db",
env: ["POSTGRES_DB=mydb", "POSTGRES_USER=user", "POSTGRES_PASSWORD=password"],
ports: {"5432/tcp": "5432"},
detach: true
}
});
3. CI/CD Pipeline Integration
Integrate Docker operations into continuous integration and deployment workflows:
// Build and push a new Docker image as part of a CI pipeline
use_mcp_tool({
server_name: "docker",
tool_name: "build_image",
arguments: {
path: ".",
dockerfile: "Dockerfile",
tag: "my-app:$(BUILD_NUMBER)"
}
});
use_mcp_tool({
server_name: "docker",
tool_name: "push_image",
arguments: {
repository: "myregistry/my-app",
tag: "$(BUILD_NUMBER)"
}
});
Configuration
The Docker MCP server does not require a connection string. It interacts directly with the Docker daemon available in its environment. Ensure Docker is running and accessible from where the MCP server is launched.
Sources
Related Articles
PostHog MCP Server: AI-Powered Analytics & Feature Flags
PostHog MCP server enables AI models to interact with PostHog analytics for project management, annotations, feature flags, and error analysis.
Sentry MCP Server
Sentry MCP servers enable AI models to interact with Sentry's error monitoring and performance tracking platform, providing capabilities for analyzing errors, tracking performance, and assisting in debugging applications.
Business Productivity MCP Servers
The Business & Productivity category provides integration with essential business tools and productivity platforms, enabling efficient workflow management and business process optimization.