Skip to main content
Glama
docker-mcp
by falkenslab

Run a container

run_container

Create and start a Docker container from an image, pulling it if missing, with optional isolation, resource limits, and confirmation for dangerous host access.

Instructions

Create and start a container from an image (pulled if missing), in the background unless detach is false. Changes the machine: confirm with the person first. With dangerous options (privileged, the host's network, processes or IPC, extra capabilities, devices, mounting the Docker socket, the host's root or the person's home), the server also asks the person itself, saying what each gives the container; if they say no, it isn't run. To try something without it reaching the computer, isolate it: network "none", cpus, memory and pids limits, readOnly, noNewPrivileges, no ports or host folders, and a label to find and remove it later (list_containers filters by label). A foreground run (detach false) is stopped and removed when timeoutSeconds runs out.

Input Schema

NameRequiredDescriptionDefault
envNoEnvironment variables
ipcNo
pidNo
cpusNoAt most this many CPUs, e.g. 1 or 0.5
nameNo
pidsNoAt most this many processes
imageYesThe image, e.g. nginx:1.27 or postgres:17
portsNoPublished ports, "host:container", e.g. "8080:80"; "127.0.0.1:8080:80" to keep them on this computer
capAddNo
detachNoIn the background (default); false waits for it to finish and returns its output
labelsNoLabels to mark it, e.g. { "docker-mcp.sandbox": "try-redis" }
memoryNoAt most this much memory, e.g. 512m or 1g
removeNoRemove it when it stops
commandNoThe command and its arguments, one per item; the image's when missing
devicesNo
networkNoA network to join; "none" cuts the container off from every network
restartNo
volumesNoMounts, "named-volume:/path" or "/host/path:/path[:ro]"
workdirNo
readOnlyNoIts root filesystem read-only (volumes keep their own mode)
privilegedNo
timeoutSecondsNoA foreground run (detach false): stop and remove it after this long; 600 by default
noNewPrivilegesNoIts processes can't gain privileges (setuid, sudo)

Output Schema

NameRequiredDescriptionDefault
outputYes
exitCodeYes
timedOutNoA foreground run that ran out of time: it was stopped and removed
containerYesIts id (detached), or its name (foreground)
truncatedYesThe start was left out: it was longer than a model's context fits

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed11 schema fields changedv0.2.0
    • removedInput schema / properties / confirmedDangerous
      Removed value: -{
      -  "description": "The person confirmed the dangerous options, knowing what they give the container",
      -  "type": "boolean"
      -}
    • addedInput schema / properties / cpus
      Added value: +{
      +  "description": "At most this many CPUs, e.g. 1 or 0.5",
      +  "pattern": "^\\d+(\\.\\d+)?$",
      +  "type": "string"
      +}
    • addedInput schema / properties / labels
      Added value: +{
      +  "additionalProperties": {
      +    "type": "string"
      +  },
      +  "description": "Labels to mark it, e.g. { \"docker-mcp.sandbox\": \"try-redis\" }",
      +  "propertyNames": {
      +    "pattern": "^[A-Za-z0-9][A-Za-z0-9_./-]*$",
      +    "type": "string"
      +  },
      +  "type": "object"
      +}
    • addedInput schema / properties / memory
      Added value: +{
      +  "description": "At most this much memory, e.g. 512m or 1g",
      +  "pattern": "^\\d+[bkmg]?$",
      +  "type": "string"
      +}
    • changedInput schema / properties / network / description
      Previous value: -"A network to join"New value: +"A network to join; \"none\" cuts the container off from every network"
    • addedInput schema / properties / noNewPrivileges
      Added value: +{
      +  "description": "Its processes can't gain privileges (setuid, sudo)",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / pids
      Added value: +{
      +  "description": "At most this many processes",
      +  "maximum": 100000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • addedInput schema / properties / readOnly
      Added value: +{
      +  "description": "Its root filesystem read-only (volumes keep their own mode)",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / timeoutSeconds
      Added value: +{
      +  "description": "A foreground run (detach false): stop and remove it after this long; 600 by default",
      +  "maximum": 3600,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • changedOutput schema / properties / container / description
      Previous value: -"Its id (detached)"New value: +"Its id (detached), or its name (foreground)"
    • addedOutput schema / properties / timedOut
      Added value: +{
      +  "description": "A foreground run that ran out of time: it was stopped and removed",
      +  "type": "boolean"
      +}
  2. First observedv0.1.0

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only mark it non-read-only, open-world-ish and non-idempotent; the description adds the crucial traits the annotations don't carry – it mutates the machine and needs human confirmation, risky flags trigger a second server-side approval, images are auto-pulled, and a foreground run is stopped and removed when timeoutSeconds expires. That is exactly the behavioral context an agent needs before invoking.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose and default behavior lead, then safety/consent, then isolation recipe, then timeout semantics – a sensible order with no filler sentences. The long comma-strung sentences (the dangerous-options list, the isolation recipe) are dense enough to slow parsing, so it falls just short of ideal.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 23-parameter mutation tool this covers the decision-critical parts: consent requirement, escalation behavior, sandbox recipe, and foreground lifecycle. An output schema exists so return values need no explanation; the only remaining gap is that a handful of low-risk parameters get no narrative treatment beyond the schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With ~65% schema coverage over 23 parameters, the description supplies meaning for the risky and least-documented ones – privileged, pid, ipc, capAdd, devices, socket/root/home mounts – by naming what each grants the container, and explains 'none' for network, cpus/memory/pids throttling, readOnly, noNewPrivileges, and label-based cleanup. It leaves env, command, name, restart and workdir entirely to the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource with scope: 'Create and start a container from an image (pulled if missing), in the background unless detach is false.' That wording separates it from start_container/restart_container, which act on an existing container, without needing to open either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says to confirm with the person first, describes the server-side escalation for dangerous options and what happens on refusal, and points to list_containers for finding/remediating labeled sandboxes. It also gives the alternative path ('to try something without it reaching the computer, isolate it') with the exact settings – clear when and how, not just what.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.