### Docker Compose Prompt Examples Source: https://github.com/ckreiling/mcp-server-docker/blob/main/README.md Examples of natural language prompts for the `docker_compose` function. These demonstrate how to describe desired containers for deployment. ```text - name: `nginx`, containers: "deploy an nginx container exposing it on port 9000" ``` ```text - name: `wordpress`, containers: "deploy a WordPress container and a supporting MySQL container, exposing Wordpress on port 9000" ``` -------------------------------- ### Start a Docker Container Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use this command to start an existing Docker container that has been previously stopped. Provide the `container_id` of the container you wish to start. ```json { "name": "start_container", "arguments": { "container_id": "my-redis" } } ``` -------------------------------- ### Docker MCP Server Installation Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Instructions for installing the Docker MCP Server using uv (PyPI) or Docker, and configuring remote Docker connections via SSH. ```APIDOC ## Installation ### Install with uv (PyPI) Configure the MCP server in Claude Desktop by adding to your configuration file (macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`, Windows: `%APPDATA%/Claude/claude_desktop_config.json`): ```json { "mcpServers": { "mcp-server-docker": { "command": "uvx", "args": [ "mcp-server-docker" ] } } } ``` ### Install with Docker Build and run the server in a Docker container: ```bash # Build the Docker image docker build -t mcp-server-docker . ``` ```json { "mcpServers": { "mcp-server-docker": { "command": "docker", "args": [ "run", "-i", "--rm", "-v", "/var/run/docker.sock:/var/run/docker.sock", "mcp-server-docker:latest" ] } } } ``` ### Connect to Remote Docker via SSH Configure a remote Docker daemon connection by setting the `DOCKER_HOST` environment variable: ```json { "mcpServers": { "mcp-server-docker": { "command": "uvx", "args": [ "mcp-server-docker" ], "env": { "DOCKER_HOST": "ssh://myusername@myhost.example.com" } } } } ``` ``` -------------------------------- ### Install MCP Server with uv Source: https://github.com/ckreiling/mcp-server-docker/blob/main/README.md Add this configuration to your MCP servers file to install the Docker MCP server using uv. Ensure uv is installed separately. ```json "mcpServers": { "mcp-server-docker": { "command": "uvx", "args": [ "mcp-server-docker" ] } } ``` -------------------------------- ### Run a Docker Container Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use the `run_container` prompt to create and start a new Docker container. This is a convenient method for single container deployments. ```python # Run a basic nginx container { "name": "run_container", "arguments": { "image": "nginx:latest", "name": "my-nginx", "detach": true, "ports": {"80/tcp": 8080} } } ``` -------------------------------- ### Configure MCP Server with uv Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Add the Docker MCP server configuration to your Claude Desktop settings when installing with uv. ```json { "mcpServers": { "mcp-server-docker": { "command": "uvx", "args": [ "mcp-server-docker" ] } } } ``` -------------------------------- ### run_container Tool Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Create and start a new Docker container in a single operation. ```APIDOC ### run_container Create and start a new Docker container in one operation. This is the preferred method over separate `create_container` + `start_container` calls. ```python # Run a basic nginx container { "name": "run_container", "arguments": { "image": "nginx:latest", "name": "my-nginx", "detach": true, "ports": {"80/tcp": 8080} } } ``` ``` -------------------------------- ### Create a Docker Container Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use this to create a new Docker container without starting it. The `create_container` command is typically used when you need to set up a container's configuration before its first run. Ensure ports are mapped correctly if external access is required. ```json { "name": "create_container", "arguments": { "image": "redis:latest", "name": "my-redis", "detach": true, "ports": {"6379/tcp": 6379} } } ``` -------------------------------- ### Install MCP Server with Docker Source: https://github.com/ckreiling/mcp-server-docker/blob/main/README.md Configure your MCP servers file to run the Docker MCP server as a container. This includes mounting the Docker socket to allow the server to control the Docker daemon. ```json "mcpServers": { "mcp-server-docker": { "command": "docker", "args": [ "run", "-i", "--rm", "-v", "/var/run/docker.sock:/var/run/docker.sock", "mcp-server-docker:latest" ] } } ``` -------------------------------- ### Run Docker Container with Custom Entrypoint and Command Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Execute a container with a custom entrypoint and command. This is useful for running specific scripts or commands upon container start. The `auto_remove` option cleans up the container after execution. ```json { "name": "run_container", "arguments": { "image": "python:3.12", "name": "python-app", "detach": false, "entrypoint": "/bin/bash", "command": "-c \'python --version\'", "auto_remove": true } } ``` -------------------------------- ### Build Docker MCP Server Image Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Build the Docker image for the MCP server using the provided Dockerfile. ```bash # Build the Docker image docker build -t mcp-server-docker . ``` -------------------------------- ### Orchestrate Containers with docker_compose Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use the `docker_compose` prompt to define and deploy multi-container applications. Provide a project name and describe the desired containers. ```python # MCP Prompt Arguments { "name": "docker_compose", "arguments": { "name": "wordpress", # Unique project name for labeling resources "containers": "deploy a WordPress container and a supporting MySQL container, exposing WordPress on port 9000" } } # The LLM will respond with a plan like: # ## Plan # I plan to take the following actions: # 1. CREATE network wordpress-network # 2. CREATE volume wordpress-db-data # 3. CREATE container wordpress-mysql (mysql:latest) # 4. CREATE container wordpress-app (wordpress:latest) on port 9000 # # Respond `apply` to apply this plan. # Commands available during the session: # - `apply`: Execute the planned actions # - `down`: Stop all containers in the project # - `ps`: List containers in the project # - `destroy`: Create a plan to remove all project resources # - `help`: Show available commands ``` -------------------------------- ### Run Docker Container with Environment Variables and Volumes Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use this to run a Docker container with specified environment variables and volume mounts. Ensure the network and labels are configured as needed. ```json { "name": "run_container", "arguments": { "image": "mysql:8.0", "name": "wordpress-mysql", "detach": true, "environment": { "MYSQL_ROOT_PASSWORD": "rootpass", "MYSQL_DATABASE": "wordpress", "MYSQL_USER": "wpuser", "MYSQL_PASSWORD": "wppass" }, "volumes": { "wordpress-db-data": {"bind": "/var/lib/mysql", "mode": "rw"} }, "network": "wordpress-network", "labels": {"mcp-server-docker.project": "wordpress"} } } ``` -------------------------------- ### Build Docker Image for MCP Server Source: https://github.com/ckreiling/mcp-server-docker/blob/main/README.md Build the Docker image for the mcp-server-docker. This command is used after cloning the repository. ```bash docker build -t mcp-server-docker . ``` -------------------------------- ### Build Docker Image Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use to build a Docker image from a Dockerfile. Specify the path to the project and the desired tag. A custom Dockerfile can be specified using the 'dockerfile' argument. ```python # Build with default Dockerfile { "name": "build_image", "arguments": { "path": "/path/to/project", "tag": "myapp:latest" } } ``` ```python # Build with custom Dockerfile { "name": "build_image", "arguments": { "path": "/path/to/project", "tag": "myapp:dev", "dockerfile": "Dockerfile.dev" } } ``` -------------------------------- ### docker_compose Prompt Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Orchestrate containers using natural language with the `docker_compose` prompt, which utilizes a plan+apply workflow. ```APIDOC ## Prompts ### docker_compose The `docker_compose` prompt enables natural language container orchestration through a plan+apply loop. Provide a project name and describe the containers you want, and the LLM will create a deployment plan for your approval. ```python # MCP Prompt Arguments { "name": "docker_compose", "arguments": { "name": "wordpress", # Unique project name for labeling resources "containers": "deploy a WordPress container and a supporting MySQL container, exposing WordPress on port 9000" } } # The LLM will respond with a plan like: # ## Plan # I plan to take the following actions: # 1. CREATE network wordpress-network # 2. CREATE volume wordpress-db-data # 3. CREATE container wordpress-mysql (mysql:latest) # 4. CREATE container wordpress-app (wordpress:latest) on port 9000 # # Respond `apply` to apply this plan. # Commands available during the session: # - `apply`: Execute the planned actions # - `down`: Stop all containers in the project # - `ps`: List containers in the project # - `destroy`: Create a plan to remove all project resources # - `help`: Show available commands ``` ``` -------------------------------- ### Configure Devbox for MCP Server Source: https://github.com/ckreiling/mcp-server-docker/blob/main/README.md Configure the MCP server to use Devbox-managed commands by specifying the full path to the Devbox profile's uv executable. ```json "docker": { "command": "/path/to/repo/.devbox/nix/profile/default/bin/uv", "args": [ "--directory", "/path/to/repo/", "run", "mcp-server-docker" ] }, ``` -------------------------------- ### Configure MCP Server with Docker Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Configure the MCP server to run within a Docker container, mounting the Docker socket for access. ```json { "mcpServers": { "mcp-server-docker": { "command": "docker", "args": [ "run", "-i", "--rm", "-v", "/var/run/docker.sock:/var/run/docker.sock", "mcp-server-docker:latest" ] } } } ``` -------------------------------- ### Push Docker Image Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use to push a Docker image to a registry. Requires specifying the repository and tag. ```python { "name": "push_image", "arguments": { "repository": "myregistry.com/myapp", "tag": "v1.0.0" } } ``` -------------------------------- ### Access Container Logs via MCP Resource Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use this resource URI format to access live logs for a running container. Returns plain text log lines, with a default tail of 100. ```python # Resource URI format "docker://containers/{container_id}/logs" ``` ```python # Example "docker://containers/abc123def456/logs" ``` ```plaintext # Returns plain text log lines (tail 100 by default) ["2024-01-15 10:30:00 Server started", "2024-01-15 10:30:01 Listening on port 80"] ``` -------------------------------- ### List Docker Images Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt List Docker images with optional filtering. Use the `all` argument to include intermediate images, or filter by `name` or `filters` such as `dangling`. ```json # List all non-intermediate images { "name": "list_images", "arguments": {} } ``` ```json # List images by repository name { "name": "list_images", "arguments": { "name": "nginx" } } ``` ```json # Show all images including intermediate layers { "name": "list_images", "arguments": { "all": true } } ``` ```json # Filter dangling images { "name": "list_images", "arguments": { "filters": { "dangling": true } } } ``` -------------------------------- ### List Docker Containers Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use the `list_containers` prompt to view Docker containers. By default, it lists only running containers. Use the `all` argument to include stopped containers and `filters` for specific criteria. ```python # List only running containers (default) { "name": "list_containers", "arguments": {} } # List all containers including stopped { "name": "list_containers", "arguments": { "all": true } } # Filter by label { "name": "list_containers", "arguments": { "all": true, "filters": { "label": ["mcp-server-docker.project=wordpress"] } } } # Response: [ { "id": "abc123...", "name": "wordpress-app", "short_id": "abc123", "status": "running", "image": {"id": "sha256:...", "tags": ["wordpress:latest"]}, "ports": {"80/tcp": [{"HostIp": "0.0.0.0", "HostPort": "9000"}]}, "labels": {"mcp-server-docker.project": "wordpress"}, "networks": ["wordpress-network"], "created": "2024-01-15T10:30:00Z" } ] ``` -------------------------------- ### List Docker Volumes Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use to list all Docker volumes. This operation does not require any arguments. ```python { "name": "list_volumes", "arguments": {} } ``` -------------------------------- ### list_containers Tool Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt List Docker containers with options to include all containers (even stopped) and filter by labels. ```APIDOC ## Container Tools ### list_containers List all Docker containers with optional filtering by status and labels. ```python # List only running containers (default) { "name": "list_containers", "arguments": {} } # List all containers including stopped { "name": "list_containers", "arguments": { "all": true } } # Filter by label { "name": "list_containers", "arguments": { "all": true, "filters": { "label": ["mcp-server-docker.project=wordpress"] } } } # Response: [ { "id": "abc123...", "name": "wordpress-app", "short_id": "abc123", "status": "running", "image": {"id": "sha256:...", "tags": ["wordpress:latest"]}, "ports": {"80/tcp": [{"HostIp": "0.0.0.0", "HostPort": "9000"}]}, "labels": {"mcp-server-docker.project": "wordpress"}, "networks": ["wordpress-network"], "created": "2024-01-15T10:30:00Z" } ] ``` ``` -------------------------------- ### Access Container Stats via MCP Resource Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use this resource URI format to access live CPU, memory, and I/O statistics for running containers. Returns JSON with container metrics. ```python # Resource URI format "docker://containers/{container_id}/stats" ``` ```python # Example "docker://containers/abc123def456/stats" ``` ```json # Returns JSON with container metrics { "cpu_stats": { "cpu_usage": {"total_usage": 123456789}, "system_cpu_usage": 987654321 }, "memory_stats": { "usage": 52428800, "limit": 2147483648 }, "networks": { "eth0": {"rx_bytes": 1024, "tx_bytes": 2048} } } ``` -------------------------------- ### Fetch Container Logs Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Retrieve logs from a container for debugging and monitoring. You can specify the number of lines to fetch using the `tail` argument, or retrieve all logs by setting `tail` to 'all'. ```json # Get last 100 lines (default) { "name": "fetch_container_logs", "arguments": { "container_id": "my-nginx" } } ``` ```json # Get last 500 lines { "name": "fetch_container_logs", "arguments": { "container_id": "wordpress-mysql", "tail": 500 } } ``` ```json # Get all logs { "name": "fetch_container_logs", "arguments": { "container_id": "my-app", "tail": "all" } } ``` -------------------------------- ### Volume Management API Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt APIs for managing Docker volumes, including listing, creating, and removing volumes. ```APIDOC ## list_volumes ### Description Lists all Docker volumes. ### Method GET ### Endpoint /volumes ### Parameters #### Request Body - **name** (string) - Required - The name of the operation, should be "list_volumes". - **arguments** (object) - Required - Arguments for the list volumes operation (empty object). ### Request Example ```json { "name": "list_volumes", "arguments": {} } ``` ### Response #### Success Response (200) - **id** (string) - The volume ID. - **name** (string) - The volume name. - **short_id** (string) - A shortened version of the volume ID. - **driver** (string) - The volume driver. - **scope** (string) - The volume scope. - **mountpoint** (string) - The mount point of the volume. - **labels** (object) - Labels associated with the volume. - **created** (string) - The creation timestamp of the volume. #### Response Example ```json [ { "id": "wordpress-db-data", "name": "wordpress-db-data", "short_id": "wordpress", "driver": "local", "scope": "local", "mountpoint": "/var/lib/docker/volumes/wordpress-db-data/_data", "labels": {"mcp-server-docker.project": "wordpress"}, "created": "2024-01-15T10:28:00Z" } ] ``` ``` ```APIDOC ## create_volume ### Description Creates a Docker volume for persistent data storage. ### Method POST ### Endpoint /volumes ### Parameters #### Request Body - **name** (string) - Required - The name of the operation, should be "create_volume". - **arguments** (object) - Required - Arguments for the create volume operation. - **name** (string) - Required - The name for the new volume. - **driver** (string) - Optional - The volume driver (defaults to "local"). - **labels** (object) - Optional - Labels to associate with the volume. ### Request Example ```json # Create a basic local volume { "name": "create_volume", "arguments": { "name": "postgres-data" } } # Create a labeled volume { "name": "create_volume", "arguments": { "name": "app-uploads", "driver": "local", "labels": { "mcp-server-docker.project": "myapp", "purpose": "user-uploads" } } } ``` ### Response #### Success Response (200) - **id** (string) - The volume ID. - **name** (string) - The volume name. - **short_id** (string) - A shortened version of the volume ID. - **driver** (string) - The volume driver. - **scope** (string) - The volume scope. - **mountpoint** (string) - The mount point of the volume. #### Response Example ```json { "id": "postgres-data", "name": "postgres-data", "short_id": "postgres", "driver": "local", "scope": "local", "mountpoint": "/var/lib/docker/volumes/postgres-data/_data" } ``` ``` ```APIDOC ## remove_volume ### Description Removes a Docker volume. ### Method DELETE ### Endpoint /volumes/{volume_name} ### Parameters #### Path Parameters - **volume_name** (string) - Required - The name of the volume to remove. #### Query Parameters - **force** (boolean) - Optional - Force removal even if the volume is in use. ### Request Example ```json # Remove a volume { "name": "remove_volume", "arguments": { "volume_name": "old-data" } } # Force remove (even if in use) { "name": "remove_volume", "arguments": { "volume_name": "postgres-data", "force": true } } ``` ### Response #### Success Response (200) - **status** (string) - The status of the removal operation. - **volume** (string) - The name of the removed volume. #### Response Example ```json { "status": "removed", "volume": "old-data" } ``` ``` -------------------------------- ### Pull Docker Image Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Pull a Docker image from a registry. This command downloads the specified image to your local machine, making it available for creating containers. ```json { "name": "pull_image", "arguments": { "name": "ubuntu:latest" } } ``` -------------------------------- ### Create Docker Network Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use to create a Docker network for container communication. Options include specifying the driver, making it internal, and applying labels. ```python # Create a basic bridge network { "name": "create_network", "arguments": { "name": "my-app-network" } } ``` ```python # Create an internal network (no external access) { "name": "create_network", "arguments": { "name": "backend-network", "driver": "bridge", "internal": true, "labels": { "mcp-server-docker.project": "myapp", "environment": "production" } } } ``` -------------------------------- ### Create Docker Volume Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use to create a Docker volume for persistent data storage. You can specify the name, driver, and labels for the volume. ```python # Create a basic local volume { "name": "create_volume", "arguments": { "name": "postgres-data" } } ``` ```python # Create a labeled volume { "name": "create_volume", "arguments": { "name": "app-uploads", "driver": "local", "labels": { "mcp-server-docker.project": "myapp", "purpose": "user-uploads" } } } ``` -------------------------------- ### Run Container API Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt API endpoints for running and managing Docker containers. ```APIDOC ## run_container ### Description Runs a Docker container with specified configurations including image, name, environment variables, volumes, and network settings. Can also be used with custom entrypoints and commands. ### Method POST ### Endpoint /run_container ### Request Body - **image** (string) - Required - The Docker image to use for the container. - **name** (string) - Optional - The name for the container. - **detach** (boolean) - Optional - Whether to run the container in detached mode. - **environment** (object) - Optional - Key-value pairs for environment variables. - **volumes** (object) - Optional - Volume mappings for the container. - **network** (string) - Optional - The network to connect the container to. - **labels** (object) - Optional - Labels to apply to the container. - **entrypoint** (string) - Optional - The entrypoint for the container. - **command** (string) - Optional - The command to run in the container. - **auto_remove** (boolean) - Optional - Whether to automatically remove the container when it exits. ### Request Example ```json { "name": "run_container", "arguments": { "image": "mysql:8.0", "name": "wordpress-mysql", "detach": true, "environment": { "MYSQL_ROOT_PASSWORD": "rootpass", "MYSQL_DATABASE": "wordpress", "MYSQL_USER": "wpuser", "MYSQL_PASSWORD": "wppass" }, "volumes": { "wordpress-db-data": {"bind": "/var/lib/mysql", "mode": "rw"} }, "network": "wordpress-network", "labels": {"mcp-server-docker.project": "wordpress"} } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the container. - **name** (string) - The name of the container. - **short_id** (string) - A short version of the container ID. - **status** (string) - The current status of the container (e.g., running, exited). - **image** (object) - Information about the image used by the container. - **ports** (object) - Port mappings for the container. - **created** (string) - The timestamp when the container was created. #### Response Example ```json { "id": "def456...", "name": "my-nginx", "short_id": "def456", "status": "running", "image": {"id": "sha256:...", "tags": ["nginx:latest"]}, "ports": {"80/tcp": [{"HostIp": "0.0.0.0", "HostPort": "8080"}]}, "created": "2024-01-15T10:35:00Z" } ``` ``` ```APIDOC ## create_container ### Description Creates a new Docker container without starting it. Use `run_container` instead for most use cases. ### Method POST ### Endpoint /create_container ### Request Body - **image** (string) - Required - The Docker image to use. - **name** (string) - Optional - The name for the container. - **detach** (boolean) - Optional - Whether to run the container in detached mode. - **ports** (object) - Optional - Port mappings for the container. ### Request Example ```json { "name": "create_container", "arguments": { "image": "redis:latest", "name": "my-redis", "detach": true, "ports": {"6379/tcp": 6379} } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the container. - **name** (string) - The name of the container. - **status** (string) - The status of the container (e.g., created). - **image** (object) - Information about the image used. #### Response Example ```json { "id": "ghi789...", "name": "my-redis", "status": "created", "image": {"id": "sha256:...", "tags": ["redis:latest"]} } ``` ``` ```APIDOC ## recreate_container ### Description Stops, removes, and recreates a container with new configuration. This is preferred over manually stopping/removing/running when updating containers. ### Method POST ### Endpoint /recreate_container ### Request Body - **container_id** (string) - Required - The ID or name of the container to recreate. - **image** (string) - Required - The new Docker image to use. - **name** (string) - Optional - The name for the container (usually the same as the original). - **detach** (boolean) - Optional - Whether to run the container in detached mode. - **ports** (object) - Optional - Port mappings for the container. - **environment** (object) - Optional - Environment variables for the new container configuration. ### Request Example ```json { "name": "recreate_container", "arguments": { "container_id": "my-nginx", "image": "nginx:1.25", "name": "my-nginx", "detach": true, "ports": {"80/tcp": 8080}, "environment": { "NGINX_HOST": "example.com" } } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the recreated container. - **name** (string) - The name of the container. - **status** (string) - The status of the recreated container (e.g., running). - **image** (object) - Information about the image used. #### Response Example ```json { "id": "jkl012...", "name": "my-nginx", "status": "running", "image": {"id": "sha256:...", "tags": ["nginx:1.25"]} } ``` ``` ```APIDOC ## start_container ### Description Starts an existing stopped container. ### Method POST ### Endpoint /start_container ### Request Body - **container_id** (string) - Required - The ID or name of the container to start. ### Request Example ```json { "name": "start_container", "arguments": { "container_id": "my-redis" } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the container. - **name** (string) - The name of the container. - **status** (string) - The new status of the container (e.g., running). #### Response Example ```json { "id": "ghi789...", "name": "my-redis", "status": "running" } ``` ``` ```APIDOC ## stop_container ### Description Stops a running container. ### Method POST ### Endpoint /stop_container ### Request Body - **container_id** (string) - Required - The ID or name of the container to stop. ### Request Example ```json { "name": "stop_container", "arguments": { "container_id": "my-nginx" } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the container. - **name** (string) - The name of the container. - **status** (string) - The new status of the container (e.g., exited). #### Response Example ```json { "id": "def456...", "name": "my-nginx", "status": "exited" } ``` ``` ```APIDOC ## remove_container ### Description Removes a Docker container. Use `force: true` to remove running containers. ### Method POST ### Endpoint /remove_container ### Request Body - **container_id** (string) - Required - The ID or name of the container to remove. - **force** (boolean) - Optional - If true, forces the removal of a running container. ### Request Example ```json # Remove a stopped container { "name": "remove_container", "arguments": { "container_id": "my-redis" } } # Force remove a running container { "name": "remove_container", "arguments": { "container_id": "my-nginx", "force": true } } ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the removed container. - **name** (string) - The name of the container. - **status** (string) - The status of the container (e.g., removed). #### Response Example ```json { "id": "def456...", "name": "my-nginx", "status": "removed" } ``` ``` ```APIDOC ## fetch_container_logs ### Description Retrieves logs from a container for debugging and monitoring. ### Method POST ### Endpoint /fetch_container_logs ### Request Body - **container_id** (string) - Required - The ID or name of the container. - **tail** (integer or string) - Optional - The number of lines to show from the end of the logs. Can be an integer or 'all'. Defaults to 100. ### Request Example ```json # Get last 100 lines (default) { "name": "fetch_container_logs", "arguments": { "container_id": "my-nginx" } } # Get last 500 lines { "name": "fetch_container_logs", "arguments": { "container_id": "wordpress-mysql", "tail": 500 } } # Get all logs { "name": "fetch_container_logs", "arguments": { "container_id": "my-app", "tail": "all" } } ``` ### Response #### Success Response (200) - **logs** (array of strings) - An array containing the log lines from the container. #### Response Example ```json { "logs": [ "2024-01-15 10:30:00 [notice] Starting nginx...", "2024-01-15 10:30:01 [info] Configuration loaded", "2024-01-15 10:30:01 [info] Server ready" ] } ``` ``` -------------------------------- ### List Docker Networks Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use to list Docker networks. Filtering by labels is supported using the 'filters' argument. ```python # List all networks { "name": "list_networks", "arguments": {} } ``` ```python # Filter by label { "name": "list_networks", "arguments": { "filters": { "label": ["mcp-server-docker.project=wordpress"] } } } ``` -------------------------------- ### Recreate a Docker Container Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Stop, remove, and recreate a container with updated configuration. This is the preferred method for updating containers as it ensures a smooth transition. Specify the `container_id` or `name` of the container to be recreated. ```json { "name": "recreate_container", "arguments": { "container_id": "my-nginx", # Or use "name" field "image": "nginx:1.25", "name": "my-nginx", "detach": true, "ports": {"80/tcp": 8080}, "environment": { "NGINX_HOST": "example.com" } } } ``` -------------------------------- ### Pull Docker Image Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt Use to pull a Docker image from a registry. Specify a tag for a specific version, or omit for the latest tag. ```json { "name": "pull_image", "arguments": { "repository": "nginx" } } ``` ```json { "name": "pull_image", "arguments": { "repository": "python", "tag": "3.12-slim" } } ``` -------------------------------- ### Network Management API Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt APIs for managing Docker networks, including listing, creating, and removing networks. ```APIDOC ## list_networks ### Description Lists Docker networks with optional filtering by labels. ### Method GET ### Endpoint /networks ### Parameters #### Query Parameters - **filters** (object) - Optional - Filters to apply to the network list. - **label** (array of strings) - Filter by labels. ### Request Example ```json # List all networks { "name": "list_networks", "arguments": {} } # Filter by label { "name": "list_networks", "arguments": { "filters": { "label": ["mcp-server-docker.project=wordpress"] } } } ``` ### Response #### Success Response (200) - **id** (string) - The network ID. - **name** (string) - The network name. - **short_id** (string) - A shortened version of the network ID. - **driver** (string) - The network driver. - **scope** (string) - The network scope. - **labels** (object) - Labels associated with the network. - **created** (string) - The creation timestamp of the network. #### Response Example ```json [ { "id": "stu901...", "name": "wordpress-network", "short_id": "stu901", "driver": "bridge", "scope": "local", "labels": {"mcp-server-docker.project": "wordpress"}, "created": "2024-01-15T10:25:00Z" } ] ``` ``` ```APIDOC ## create_network ### Description Creates a Docker network for container communication. ### Method POST ### Endpoint /networks ### Parameters #### Request Body - **name** (string) - Required - The name of the operation, should be "create_network". - **arguments** (object) - Required - Arguments for the create network operation. - **name** (string) - Required - The name for the new network. - **driver** (string) - Optional - The network driver (defaults to "bridge"). - **internal** (boolean) - Optional - Whether the network is internal. - **labels** (object) - Optional - Labels to associate with the network. ### Request Example ```json # Create a basic bridge network { "name": "create_network", "arguments": { "name": "my-app-network" } } # Create an internal network (no external access) { "name": "create_network", "arguments": { "name": "backend-network", "driver": "bridge", "internal": true, "labels": { "mcp-server-docker.project": "myapp", "environment": "production" } } } ``` ### Response #### Success Response (200) - **id** (string) - The network ID. - **name** (string) - The network name. - **short_id** (string) - A shortened version of the network ID. - **driver** (string) - The network driver. - **scope** (string) - The network scope. #### Response Example ```json { "id": "vwx234...", "name": "my-app-network", "short_id": "vwx234", "driver": "bridge", "scope": "local" } ``` ``` ```APIDOC ## remove_network ### Description Removes a Docker network. ### Method DELETE ### Endpoint /networks/{network_id} ### Parameters #### Path Parameters - **network_id** (string) - Required - The ID or name of the network to remove. ### Request Example ```json { "name": "remove_network", "arguments": { "network_id": "my-app-network" } } ``` ### Response #### Success Response (200) - **id** (string) - The ID of the removed network. - **name** (string) - The name of the removed network. - **short_id** (string) - A shortened version of the network ID. - **driver** (string) - The network driver. #### Response Example ```json { "id": "vwx234...", "name": "my-app-network", "short_id": "vwx234", "driver": "bridge" } ``` ``` -------------------------------- ### Image Tools API Source: https://context7.com/ckreiling/mcp-server-docker/llms.txt API endpoints for managing Docker images. ```APIDOC ## list_images ### Description Lists Docker images with optional filtering. ### Method POST ### Endpoint /list_images ### Request Body - **name** (string) - Optional - Filter images by repository name. - **all** (boolean) - Optional - Show all images including intermediate layers. - **filters** (object) - Optional - Filter images based on specific criteria (e.g., dangling). ### Request Example ```json # List all non-intermediate images { "name": "list_images", "arguments": {} } # List images by repository name { "name": "list_images", "arguments": { "name": "nginx" } } # Show all images including intermediate layers { "name": "list_images", "arguments": { "all": true } } # Filter dangling images { "name": "list_images", "arguments": { "filters": { "dangling": true } } } ``` ### Response #### Success Response (200) - An array of image objects, each containing: - **id** (string) - The unique identifier of the image. - **short_id** (string) - A short version of the image ID. - **tags** (array of strings) - Tags associated with the image. - **repo_tags** (array of strings) - Repository tags for the image. - **labels** (object) - Labels applied to the image. - **created** (string) - The timestamp when the image was created. - **size** (integer) - The size of the image in bytes. #### Response Example ```json [ { "id": "sha256:abc123...", "short_id": "sha256:abc1", "tags": ["nginx:latest", "nginx:1.25"], "repo_tags": ["nginx:latest"], "labels": {}, "created": "2024-01-10T08:00:00Z", "size": 187000000 } ] ``` ``` ```APIDOC ## pull_image ### Description Pulls a Docker image from a registry. ### Method POST ### Endpoint /pull_image ### Request Body - **name** (string) - Required - The name of the image to pull (e.g., 'ubuntu:latest'). - **tag** (string) - Optional - The tag of the image to pull. If not provided, 'latest' is assumed. ### Request Example ```json { "name": "pull_image", "arguments": { "name": "nginx", "tag": "1.25" } } ``` ### Response #### Success Response (200) - **status** (string) - The status of the pull operation (e.g., 'success'). - **id** (string) - The ID of the pulled image. #### Response Example ```json { "status": "success", "id": "sha256:xyz789..." } ``` ```