compose_run
Run a one-off command in a new Docker Compose service container, returning output and exit code. Starts a fresh container instead of using an existing one for isolated tasks.
Instructions
Run a one-off command against a compose service.
Always passes -T (no TTY under MCP). Defaults to detached with --rm so the call returns
promptly. Unlike compose_exec, this starts a NEW container for the service rather than
running inside the existing one.
Does not raise on a non-zero CLI exit (a missing compose plugin or a timeout still raises) - inspect
returncode/stderr in the result.
Args:
service: Service name from the compose file
command: Command + args to run (exec-form; no shell unless you invoke one)
project_dir: Dir with the compose file (default: server cwd; copied to the target host if no local plugin)
files: Explicit compose file paths (repeatable, -f)
project_name: Compose project name override
detach: Run detached
rm: Remove the container after the run
no_deps: Don't start linked services
workdir: Working directory inside the container
user: User to run as inside the container (uid or name)
env: Environment variables to set inside the container
name: Container name
timeout_seconds: Subprocess timeout (default 600s)
Returns: dict: {"returncode": int, "stdout": str, "stderr": str, "truncated": bool}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rm | No | ||
| env | No | ||
| name | No | ||
| user | No | ||
| files | No | ||
| detach | No | ||
| command | No | ||
| no_deps | No | ||
| service | Yes | ||
| workdir | No | ||
| project_dir | No | ||
| project_name | No | ||
| timeout_seconds | No |