Docker MCP Server

The Docker Model Context Protocol server enables seamless interaction with Docker containers and infrastructure through function calling.

Capabilities

  • 🚀 Compose containers with natural language
  • 🔍 Introspect & debug running containers
  • 📀 Manage persistent data with Docker volumes

Target Users

  • Server administrators: Connect to remote Docker engines for managing public-facing websites and services
  • Tinkerers: Spin up containers locally without manual command execution

Installation

Claude Desktop Configuration

Add to your configuration file at:

  • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%/Claude/claude_desktop_config.json

Docker Compose

Use natural language to compose containers. Provide a Project Name and description of desired containers, and let the LLM handle the rest.

Workflow

  1. Provide container setup instructions to the LLM
  2. Review the LLM's natural language plan
  3. Either:
    • Apply the plan
    • Provide feedback for plan recalculation

Examples

name: nginx, containers: "deploy an nginx container exposing it on port 9000"
name: wordpress, containers: "deploy a WordPress container and a supporting MySQL container, exposing WordPress on port 9000"

Available Tools

Container Management

  • list_containers: View all containers
  • create_container: Create a new container
  • run_container: Create and start a container
  • recreate_container: Recreate an existing container
  • start_container: Start a stopped container
  • fetch_container_logs: View container logs
  • stop_container: Stop a running container
  • remove_container: Remove a container

Image Management

  • list_images: View available images
  • pull_image: Download an image
  • push_image: Upload an image
  • build_image: Build a new image
  • remove_image: Delete an image

Network Management

  • list_networks: View all networks
  • create_network: Create a new network
  • remove_network: Delete a network

Volume Management

  • list_volumes: View all volumes
  • create_volume: Create a new volume
  • remove_volume: Delete a volume

Resources

The server provides these resources for each container:

  • Stats: CPU, memory, and other container metrics
  • Logs: Container log access and tailing

Security Considerations

Important Security Notes

  • Do not configure containers with sensitive data (API keys, passwords, etc.)
  • Any sensitive data shared with the LLM is potentially compromised unless running locally
  • Review all containers created by the LLM as Docker is not a secure sandbox
  • The server does not support sensitive Docker options like --privileged or --cap-add/--cap-drop

Configuration

This server uses the Python Docker SDK's from_env method. For detailed configuration options, refer to the official documentation.

Mastodon