Docker MCP Server
The Docker MCP Server is an AI-native Model Context Protocol server that enables AI assistants (like GitHub Copilot and Claude) to manage Docker resources through natural language commands.
Container Management
List all containers (running or all)
Create a container with full configuration: image, name, environment variables, commands, entrypoints, port mappings, volume bindings, and labels
Run a container (create + start in one step) โ the preferred method
Start, stop (with configurable timeout), restart, pause, unpause, and rename containers
Remove containers (with options to force or remove associated volumes)
Inspect containers and retrieve logs (with tail and follow options) and stats
Image Operations
List, pull, build, push, tag, remove, and prune Docker images
Network Management
List, create, inspect, connect/disconnect containers, remove, and prune networks
Volume Management
List, create, inspect, remove, and prune volumes
System & Connectivity
Get Docker system info and version details
Validate and test Docker connections
Connect to remote Docker hosts via TCP, HTTPS with TLS certificate authentication, or SSH tunnels
Provides tools for interacting with the Docker daemon to manage containers, images, networks, and volumes, including capabilities for container lifecycle management, log retrieval, and detailed resource inspection.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Docker MCP Server list all running containers and show their status"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Docker MCP Server
A comprehensive, production-ready, industry-standard compliant MCP (Model Context Protocol) Server that enables full Docker management capabilities for AI assistants like GitHub Copilot and Claude. Featuring 37 powerful tools covering containers, images, networks, volumes, and system operations.
๐ Table of Contents
Related MCP server: DockerHub MCP Server
About
Docker MCP Server is a Model Context Protocol server that bridges AI assistants with Docker, enabling natural language Docker operations. Built with TypeScript and following industry best practices, it provides a complete Docker management solution for AI-powered development workflows.
Why Docker MCP Server?
๐ค AI-Native: Designed specifically for AI assistants (GitHub Copilot, Claude)
๐ง Complete Coverage: 37 tools covering all essential Docker operations
๐ Remote Support: Connect to Docker on any host via TCP, HTTPS, or SSH tunnel
๐ Security First: Full TLS/SSL support with certificate authentication
๐ฆ Production Ready: Comprehensive error handling, type safety, and testing
๐ Well Documented: Extensive documentation with examples for every feature
๐ Easy to Use: Simple installation and configuration
Use Cases
AI-Assisted DevOps: Let AI assistants manage your Docker infrastructure
Container Orchestration: Create, manage, and monitor containers through natural language
Development Automation: Automate Docker workflows with AI assistance
Remote Management: Securely manage Docker on remote hosts
Learning & Exploration: Explore Docker capabilities with AI guidance
Quick Start
For npm Users (Recommended)
# Install globally
npm install -g @swartdraak/docker-mcp-server
# Or use with npx (no installation needed)
npx @swartdraak/docker-mcp-serverFor Developers
# Clone the repository
git clone https://github.com/Swartdraak/Docker-MCP.git
cd Docker-MCP
# Install dependencies
npm install
# Build the project
npm run build
# Start the server
npm startโจ Features
Core Capabilities
โ 37 Docker Tools: Complete coverage of Docker operations including connection validation
โ Remote Docker Support: Connect to Docker on remote hosts via TCP, HTTP, HTTPS, or SSH tunnel
โ Secure Connections: Full TLS/SSL support for secure remote Docker management
โ Container Management: Create, run, start, stop, restart, pause, unpause, rename, remove, exec, stats, logs
โ Image Operations: List, pull, build, push, tag, remove, prune
โ Network Management: List, create, remove, inspect, connect, disconnect
โ Volume Management: List, create, remove, inspect, prune
โ System Operations: Info, version, connection validation, prune (containers, images, volumes, networks)
โ Proper Array Handling: Correctly handles command, entrypoint, and environment variables
โ VS Code Integration: Works seamlessly with GitHub Copilot
โ Industry Standard: Uses MCP SDK and Docker best practices
โ TypeScript: Full type safety and modern JavaScript features
Recent Enhancements
๐ Remote Docker Host Support: Connect to Docker on any remote host
๐ TLS/HTTPS Support: Secure connections with certificate authentication
๐ Environment-based Configuration: Easy setup via DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH
๐ SSH Tunnel Support: Secure remote access without exposing Docker API
What's New in v2.0
๐ 25 New Tools: Added extensive container, image, network, and volume management
๐ง Container Exec: Execute commands in running containers
๐ Container Stats: Real-time CPU, memory, network, and I/O metrics
๐๏ธ Image Building: Build images from Dockerfile with build args
๐ Advanced Lifecycle: Restart, pause, unpause, rename containers
๐ Full Network CRUD: Create, inspect, connect, disconnect, remove networks
๐พ Full Volume CRUD: Create, inspect, remove volumes
๐งน Resource Cleanup: Prune unused containers, images, volumes, networks
โ๏ธ System Info: Get Docker daemon information and version
Installation
Via npm (Recommended)
npm install -g @swartdraak/docker-mcp-serverFrom Source
Prerequisites
Node.js 18 or higher
Docker installed and running
npm or yarn package manager
Setup
Clone the repository:
git clone https://github.com/Swartdraak/Docker-MCP.git
cd Docker-MCPInstall dependencies:
npm installBuild the project:
npm run buildUsage
Standalone Mode
Run the server directly:
npm startRemote Docker Configuration
The MCP server supports connecting to remote Docker hosts using environment variables:
Connect to Remote Docker via TCP
DOCKER_HOST=tcp://192.168.1.100:2375 npm startConnect to Remote Docker via HTTPS with TLS
DOCKER_HOST=https://192.168.1.100:2376 \
DOCKER_TLS_VERIFY=1 \
DOCKER_CERT_PATH=~/.docker/certs \
npm startConnect via SSH Tunnel
First, set up an SSH tunnel:
ssh -NL localhost:2375:/var/run/docker.sock user@remote-hostThen connect to the tunneled Docker:
DOCKER_HOST=tcp://localhost:2375 npm startVS Code Integration
To integrate with VS Code and GitHub Copilot, add the following to your MCP settings file:
For Local Docker (~/.vscode/mcp-settings.json or in your workspace settings):
{
"mcpServers": {
"docker": {
"command": "node",
"args": ["/path/to/Docker-MCP/dist/index.js"]
}
}
}For Remote Docker over TCP:
{
"mcpServers": {
"docker": {
"command": "node",
"args": ["/path/to/Docker-MCP/dist/index.js"],
"env": {
"DOCKER_HOST": "tcp://192.168.1.100:2375"
}
}
}
}For Remote Docker with TLS:
{
"mcpServers": {
"docker": {
"command": "node",
"args": ["/path/to/Docker-MCP/dist/index.js"],
"env": {
"DOCKER_HOST": "https://192.168.1.100:2376",
"DOCKER_TLS_VERIFY": "1",
"DOCKER_CERT_PATH": "/home/user/.docker/certs"
}
}
}
}For Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"docker": {
"command": "node",
"args": ["/path/to/Docker-MCP/dist/index.js"]
}
}
}Alternative using npx (after publishing to npm):
{
"mcpServers": {
"docker": {
"command": "npx",
"args": ["@swartdraak/docker-mcp-server"]
}
}
}Testing Your Connection
Connection Test Utility
Before using the MCP server, you can test your Docker connection with the included test utility:
# Test local Docker connection
node test-connection.js
# Test remote Docker via TCP
DOCKER_HOST=tcp://192.168.1.100:2375 node test-connection.js
# Test remote Docker via TLS
DOCKER_HOST=https://192.168.1.100:2376 \
DOCKER_TLS_VERIFY=1 \
DOCKER_CERT_PATH=~/.docker/certs \
node test-connection.js
# Test SSH tunnel connection
DOCKER_HOST=tcp://localhost:2375 node test-connection.jsThe test utility will:
โ Validate your configuration
โ Check TLS certificates (if applicable)
โ Test connection to Docker daemon
โ Verify Docker operations (list containers, images, networks, volumes)
โ Display system information
โ Provide troubleshooting recommendations
validate_connection Tool
Once the MCP server is running, you can also use the validate_connection tool from your AI assistant:
"Validate my Docker connection"This tool performs runtime connectivity tests and returns:
Connection status
Docker version and API information
System information
Test results for common operations
Manual Testing
You can also test your connection directly with Docker CLI:
# Set environment variables
export DOCKER_HOST=tcp://192.168.1.100:2375
# Test commands
docker version
docker info
docker psFor detailed setup instructions, troubleshooting, and platform-specific guides, see:
CONFIGURATION.md - MCP server configuration examples
REMOTE_SETUP.md - Comprehensive remote connection setup guide (includes Windows 11 specific instructions)
Available Tools (37 Total)
Container Operations (15 tools)
list_containers
List all Docker containers (running or all)
{
"all": true
}create_container
Create a new Docker container
{
"image": "nginx:latest",
"name": "my-nginx",
"command": ["nginx", "-g", "daemon off;"],
"env": ["NODE_ENV=production"],
"exposedPorts": {"80/tcp": {}},
"hostConfig": {
"PortBindings": {"80/tcp": [{"HostPort": "8080"}]},
"Binds": ["/host/path:/container/path"]
}
}run_container
Create and start a container (recommended)
{
"image": "python:3.9",
"name": "my-python-app",
"command": ["python", "app.py"],
"env": ["DEBUG=true", "PORT=5000"]
}start_container
Start a stopped container
{
"containerId": "container_id_or_name"
}stop_container
Stop a running container
{
"containerId": "container_id_or_name",
"timeout": 10
}remove_container
Remove a container
{
"containerId": "container_id_or_name",
"force": false,
"volumes": false
}inspect_container
Get detailed container information
{
"containerId": "container_id_or_name"
}container_logs
Get container logs
{
"containerId": "container_id_or_name",
"tail": 100,
"follow": false
}exec_container ๐
Execute a command in a running container
{
"containerId": "container_id_or_name",
"command": ["ls", "-la", "/app"],
"workingDir": "/app",
"env": ["DEBUG=true"]
}container_stats ๐
Get real-time resource usage statistics (CPU, memory, network, I/O)
{
"containerId": "container_id_or_name",
"stream": false
}restart_container ๐
Restart a Docker container
{
"containerId": "container_id_or_name",
"timeout": 10
}pause_container ๐
Pause all processes within a container
{
"containerId": "container_id_or_name"
}unpause_container ๐
Unpause all processes within a container
{
"containerId": "container_id_or_name"
}rename_container ๐
Rename a Docker container
{
"containerId": "container_id_or_name",
"newName": "new-container-name"
}prune_containers ๐
Remove all stopped containers
{}Image Operations (7 tools)
list_images
List Docker images
{
"all": false
}pull_image
Pull an image from registry
{
"image": "nginx:latest"
}build_image ๐
Build a Docker image from a Dockerfile
{
"context": "/path/to/build/context",
"dockerfile": "Dockerfile",
"tag": "myimage:latest",
"buildArgs": {
"NODE_VERSION": "18"
}
}tag_image ๐
Tag an image with a new name/tag
{
"image": "myimage:latest",
"repo": "myrepo/myimage",
"tag": "v1.0.0"
}push_image ๐
Push an image to a Docker registry
{
"image": "myrepo/myimage:v1.0.0"
}remove_image ๐
Remove a Docker image
{
"image": "image_id_or_name",
"force": false
}prune_images ๐
Remove unused images
{
"all": false
}Network Operations (7 tools)
list_networks
List Docker networks
{}create_network ๐
Create a Docker network
{
"name": "my-network",
"driver": "bridge",
"internal": false
}inspect_network ๐
Get detailed information about a network
{
"networkId": "network_id_or_name"
}connect_network ๐
Connect a container to a network
{
"networkId": "network_id_or_name",
"containerId": "container_id_or_name"
}disconnect_network ๐
Disconnect a container from a network
{
"networkId": "network_id_or_name",
"containerId": "container_id_or_name",
"force": false
}remove_network ๐
Remove a Docker network
{
"networkId": "network_id_or_name"
}prune_networks ๐
Remove all unused networks
{}Volume Operations (5 tools)
list_volumes
List Docker volumes
{}create_volume ๐
Create a Docker volume
{
"name": "my-volume",
"driver": "local",
"labels": {
"environment": "production"
}
}inspect_volume ๐
Get detailed information about a volume
{
"volumeName": "volume_name"
}remove_volume ๐
Remove a Docker volume
{
"volumeName": "volume_name",
"force": false
}prune_volumes ๐
Remove all unused volumes
{}System Operations (3 tools)
system_info ๐
Get Docker system information
{}system_version ๐
Get Docker version information
{}validate_connection ๐
Validate Docker connection and test basic operations. Returns connection status, configuration details, and test results. Useful for troubleshooting connection issues.
{}Key Features: Array Handling
This MCP server correctly handles arrays for:
Command: Passed as an array of strings
["python", "app.py", "--port", "8000"]Entrypoint: Passed as an array of strings
["/bin/bash", "-c"]Environment Variables: Passed as an array of
KEY=VALUEstrings["NODE_ENV=production", "PORT=3000"]Volume Bindings: Passed as an array of bind strings
["/host/path:/container/path"]
This resolves the common "array issue" where MCP servers incorrectly expect strings instead of arrays, causing errors when integrated with VS Code and GitHub Copilot.
Development
Scripts
npm run build- Compile TypeScript to JavaScriptnpm run watch- Watch mode for developmentnpm start- Run the compiled servernpm run dev- Build and run
Project Structure
Docker-MCP/
โโโ src/
โ โโโ index.ts # Main server implementation
โโโ dist/ # Compiled JavaScript output
โโโ package.json # Project dependencies
โโโ tsconfig.json # TypeScript configuration
โโโ README.md # This fileTroubleshooting
Docker Connection Issues
If you get "Cannot connect to Docker daemon" errors:
Ensure Docker is running:
docker psCheck Docker socket permissions
On Linux: Add your user to the docker group:
sudo usermod -aG docker $USER
Remote Docker Connection Issues
If you can't connect to a remote Docker host:
TCP Connection Issues:
Ensure the Docker daemon is configured to listen on TCP: Check
/etc/docker/daemon.jsonVerify the port is open:
telnet remote-host 2375Check firewall rules on the remote host
Ensure
DOCKER_HOSTenvironment variable is set correctly
TLS/HTTPS Connection Issues:
Verify certificates are in the correct directory
Check certificate file names:
ca.pem,cert.pem,key.pemEnsure certificates are readable:
chmod 644 ca.pem cert.pem key.pemVerify
DOCKER_TLS_VERIFY=1andDOCKER_CERT_PATHare setTest with Docker CLI first:
docker --tlsverify --host=tcp://remote-host:2376 ps
SSH Tunnel Issues:
Verify SSH tunnel is running:
ps aux | grep sshTest tunnel:
curl http://localhost:2375/versionEnsure local port is not already in use:
lsof -i :2375Try reconnecting the tunnel if connection is lost
VS Code Integration Issues
If the MCP server doesn't appear in VS Code:
Verify the path to
dist/index.jsis absoluteCheck that the server builds successfully:
npm run buildRestart VS Code after updating MCP settings
Check VS Code Output panel for MCP-related errors
Verify environment variables in MCP settings are correct
Array-Related Errors
This server is specifically designed to handle arrays correctly. If you encounter array errors:
Ensure you're passing arrays for
command,entrypoint, andenvfieldsVerify JSON formatting in tool arguments
Check that arrays contain string items
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Workflow
This project follows industry-standard practices:
Branching Strategy: Git Flow (see BRANCHING.md)
Versioning: Semantic Versioning 2.0.0 (see VERSIONING.md)
Commit Convention: Conventional Commits
CI/CD: Automated testing and releases via GitHub Actions
Quick Start for Contributors
Fork the repository
Create a feature branch:
git checkout -b feature/my-featureMake your changes with conventional commits
Ensure tests pass:
npm testPush and create a Pull Request to
develop
For detailed guidelines, see CONTRIBUTING.md.
Branch Structure
main- Production releases (protected)develop- Integration branch (protected)feature/*- New featuresbugfix/*- Bug fixeshotfix/*- Critical production fixes
Release Process
Releases are automated via GitHub Actions when tags are pushed:
# Create release branch
git checkout -b release/2.1.0
# Update version and changelog
npm version minor
# Merge to main and tag
git checkout main
git merge --no-ff release/2.1.0
git tag -a v2.1.0 -m "Version 2.1.0"
git push origin main --tagsSee VERSIONING.md for complete release procedures.
For detailed usage examples, see EXAMPLES.md.
For configuration help, see CONFIGURATION.md.
Documentation
User Documentation
README.md - Main documentation and quick start
CONFIGURATION.md - Configuration options and setup
EXAMPLES.md - Usage examples for all tools
REMOTE_SETUP.md - Remote Docker connection setup
MIGRATION.md - Migration guides for version upgrades
Developer Documentation
CONTRIBUTING.md - Contribution guidelines and workflow
BRANCHING.md - Git Flow branching strategy
VERSIONING.md - Semantic versioning and release process
RELEASE_GUIDE.md - npm package release procedures
BRANCH_PROTECTION.md - Branch protection setup guide
CHANGELOG.md - Version history and changes
SECURITY.md - Security policies and reporting
License
MIT License - see LICENSE file for details
Author
Swartdraak (eternusprocer@gmail.com)
Available Tools
12 toolscontainer_logsC
Get logs from a container
Inputs: containerId (required), tail, follow.
create_containerC
Create a new Docker container
Inputs: image (required), name, command, entrypoint, +4 more.
inspect_containerC
Get detailed information about a container
Inputs: containerId (required).
list_containersC
List all Docker containers
Inputs: all.
list_imagesC
List Docker images
Inputs: all.
list_networksB
List Docker networks
Inputs: no named parameters.
list_volumesB
List Docker volumes
Inputs: no named parameters.
pull_imageC
Pull a Docker image from a registry
Inputs: image (required).
remove_containerC
Remove a Docker container
Inputs: containerId (required), force, volumes.
run_containerB
Run a container (create and start). This is the preferred method for starting containers.
Inputs: image (required), name, command, entrypoint, +4 more.
start_containerB
Start a stopped Docker container
Inputs: containerId (required).
stop_containerC
Stop a running Docker container
Inputs: containerId (required), timeout.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 12 tools
Every tool has a clearly distinct purpose targeting specific Docker resources and actions. For example, create_container and run_container are well-differentiated by their descriptions, with run_container explicitly noted as the preferred method for starting containers. There is no ambiguity or overlap in functionality across the tool set.
All tool names follow a consistent verb_noun pattern using snake_case, such as list_containers, create_container, and stop_container. This predictable naming convention makes it easy for agents to understand and select the appropriate tools without confusion.
With 12 tools, the server is well-scoped for managing Docker containers, images, networks, and volumes. Each tool earns its place by covering essential operations like creation, listing, starting, stopping, and removal, without being overly sparse or bloated.
The tool set provides strong coverage for core Docker operations, including CRUD for containers and listing for other resources. Minor gaps exist, such as no tools for creating or removing networks/volumes, but agents can still perform most workflows effectively with the available tools.
Maintenance
Related MCP Connectors
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
Hosting for AI agents: your AI client deploys Docker apps to live HTTPS URLs over MCP.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
One MCP server for the services your AI needs: memory, files, Microsoft 365, kanban and more.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn AI-powered MCP server for managing Docker infrastructure, enabling creation, deployment, and lifecycle management of containerized services with automated DNS and SSL.10MIT
- AlicenseNot gradedqualityDmaintenanceA production-ready Model Context Protocol (MCP) server that provides comprehensive DockerHub integration for AI assistants. This server enables AI assistants to search, analyze, and manage Docker images through standardized MCP tools.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to manage Docker containers through a secure MCP interface, supporting container lifecycle operations, log inspection, resource monitoring, and system diagnostics with role-based access control.3MIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that gives any LLM client the ability to list, inspect, start, stop, and monitor Docker containers on the host machine.1-