Docker MCP Server

Manage Docker containers, images, networks, and volumes through AI assistants using natural language with the Docker MCP Server.

May 4, 2026
GitHub starsPyPI version

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

ToolPurposeCategory
list_containersList all containersContainers
create_containerCreate a new containerContainers
run_containerCreate and start a containerContainers
recreate_containerRecreate an existing containerContainers
start_containerStart a stopped containerContainers
stop_containerStop a running containerContainers
remove_containerRemove a containerContainers
fetch_container_logsGet container logsContainers
list_imagesList available imagesImages
pull_imagePull an image from registryImages
push_imagePush an image to registryImages
build_imageBuild an image from sourceImages
remove_imageRemove an imageImages
list_networksList Docker networksNetworks
create_networkCreate a networkNetworks
remove_networkRemove a networkNetworks
list_volumesList Docker volumesVolumes
create_volumeCreate a volumeVolumes
remove_volumeRemove a volumeVolumes

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