Back to Codex
Dev Tools·
advanced
·10 min read·Apr 4, 2026

How to Use the Docker MCP Server for Container Management

Manage Docker containers, images, and volumes through your AI agent using the Docker MCP server. Build, run, and monitor containers with natural language.

DockercontainersDevOpsinfrastructuredeployment

Use the Docker MCP Server for Container Management

The Docker MCP server lets AI agents manage Docker containers, images, volumes, and networks through natural language commands.

Prerequisites

  • Docker Desktop or Docker Engine installed
  • Docker daemon running
  • Node.js 18+

Configuration

json
{
  "mcpServers": {
    "docker": {
      "command": "npx",
      "args": ["-y", "mcp-server-docker"]
    }
  }
}

Available Tools

Container Operations

  • code
    list_containers
    — List running and stopped containers
  • code
    create_container
    — Create new containers from images
  • code
    start_container
    /
    code
    stop_container
    — Manage container lifecycle
  • code
    remove_container
    — Delete containers
  • code
    container_logs
    — View container output
  • code
    container_stats
    — Get resource usage statistics

Image Operations

  • code
    list_images
    — List available images
  • code
    pull_image
    — Pull images from registries
  • code
    build_image
    — Build images from Dockerfiles
  • code
    remove_image
    — Delete images

Volume & Network

  • code
    list_volumes
    — List Docker volumes
  • code
    create_volume
    — Create new volumes
  • code
    list_networks
    — List Docker networks

Example Workflows

Container Monitoring

code
"Show me all running containers and their resource usage"

Quick Deployment

code
"Pull the latest nginx image and run it on port 8080 with the name 'web-server'"

Cleanup

code
"List all stopped containers and remove them, then remove any unused images"

Development Environment

code
"Create a PostgreSQL container with persistent volume for development, exposed on port 5433"

Security Considerations

  • The Docker MCP server has full Docker access — use with caution
  • Consider running in a restricted Docker context
  • Don't expose on production systems without proper access controls
  • Use Docker's built-in security features (user namespaces, seccomp profiles)