Run a container
run_containerCreate 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
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Environment variables | |
| ipc | No | ||
| pid | No | ||
| cpus | No | At most this many CPUs, e.g. 1 or 0.5 | |
| name | No | ||
| pids | No | At most this many processes | |
| image | Yes | The image, e.g. nginx:1.27 or postgres:17 | |
| ports | No | Published ports, "host:container", e.g. "8080:80"; "127.0.0.1:8080:80" to keep them on this computer | |
| capAdd | No | ||
| detach | No | In the background (default); false waits for it to finish and returns its output | |
| labels | No | Labels to mark it, e.g. { "docker-mcp.sandbox": "try-redis" } | |
| memory | No | At most this much memory, e.g. 512m or 1g | |
| remove | No | Remove it when it stops | |
| command | No | The command and its arguments, one per item; the image's when missing | |
| devices | No | ||
| network | No | A network to join; "none" cuts the container off from every network | |
| restart | No | ||
| volumes | No | Mounts, "named-volume:/path" or "/host/path:/path[:ro]" | |
| workdir | No | ||
| readOnly | No | Its root filesystem read-only (volumes keep their own mode) | |
| privileged | No | ||
| timeoutSeconds | No | A foreground run (detach false): stop and remove it after this long; 600 by default | |
| noNewPrivileges | No | Its processes can't gain privileges (setuid, sudo) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output | Yes | ||
| exitCode | Yes | ||
| timedOut | No | A foreground run that ran out of time: it was stopped and removed | |
| container | Yes | Its id (detached), or its name (foreground) | |
| truncated | Yes | The start was left out: it was longer than a model's context fits |