← All procedures

docker.exec

Execute command in a running container

MCPCLI
Package
@procedures/docker · README
Path
["docker","exec"]
CLI
mark docker exec --container <string> --command <string>
MCP tool
docker.exec on the dev-tools server
As data
{"$proc":["docker","exec"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/docker"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["docker","exec"], { container: "<container>", command: "<command>" });
console.log(JSON.stringify(result));

From the command line

$ mark docker exec --container <string> --command <string>

As data, in a program

{
  "$proc": ["docker", "exec"],
  "input": { "container": "<container>", "command": "<command>" }
}

Input

FieldTypeRequiredDefaultDescription
containerstringyesContainer name or ID
commandstringyesCommand to execute
interactivebooleannoRun interactively
ttybooleannoAllocate a TTY
workdirstringnoWorking directory inside container
envobjectnoEnvironment variables
cwdstringnoWorking directory (host)
timeoutnumbernoTimeout in milliseconds

Output

FieldTypeRequiredDefaultDescription
exitCodenumberyesThe exit code of docker (0 is success)
stdoutstringyesThe standard output of docker
stderrstringyesThe standard error of docker, or the error message when docker did not start
successbooleanyesTrue when the exit code is 0
durationnumberyesThe time of the command, in milliseconds
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "container": {
        "type": "string",
        "description": "Container name or ID"
      },
      "command": {
        "type": "string",
        "description": "Command to execute"
      },
      "interactive": {
        "description": "Run interactively",
        "type": "boolean"
      },
      "tty": {
        "description": "Allocate a TTY",
        "type": "boolean"
      },
      "workdir": {
        "description": "Working directory inside container",
        "type": "string"
      },
      "env": {
        "description": "Environment variables",
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": "string"
        }
      },
      "cwd": {
        "description": "Working directory (host)",
        "type": "string"
      },
      "timeout": {
        "description": "Timeout in milliseconds",
        "type": "number"
      }
    },
    "required": [
      "container",
      "command"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "exitCode": {
        "type": "number",
        "description": "The exit code of docker (0 is success)"
      },
      "stdout": {
        "type": "string",
        "description": "The standard output of docker"
      },
      "stderr": {
        "type": "string",
        "description": "The standard error of docker, or the error message when docker did not start"
      },
      "success": {
        "type": "boolean",
        "description": "True when the exit code is 0"
      },
      "duration": {
        "type": "number",
        "description": "The time of the command, in milliseconds"
      }
    },
    "required": [
      "exitCode",
      "stdout",
      "stderr",
      "success",
      "duration"
    ],
    "additionalProperties": {}
  }
}