← All procedures

docker.logs

Get container logs

MCPCLI
Package
@procedures/docker · README
Path
["docker","logs"]
CLI
mark docker logs --container <string>
MCP tool
docker.logs on the dev-tools server
As data
{"$proc":["docker","logs"],"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","logs"], { container: "<container>" });
console.log(JSON.stringify(result));

From the command line

$ mark docker logs --container <string>

As data, in a program

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

Input

FieldTypeRequiredDefaultDescription
containerstringyesContainer name or ID
followbooleannoFollow log output
tailnumbernoNumber of lines from end
timestampsbooleannoShow timestamps
cwdstringnoWorking directory
timeoutnumbernoTimeout in milliseconds

Output

The schema does not list fields (object | object | object).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "container": {
        "type": "string",
        "description": "Container name or ID"
      },
      "follow": {
        "description": "Follow log output",
        "type": "boolean"
      },
      "tail": {
        "description": "Number of lines from end",
        "type": "number"
      },
      "timestamps": {
        "description": "Show timestamps",
        "type": "boolean"
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      },
      "timeout": {
        "description": "Timeout in milliseconds",
        "type": "number"
      }
    },
    "required": [
      "container"
    ]
  },
  "output": {
    "anyOf": [
      {
        "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": {}
      },
      {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "stdout",
              "stderr"
            ],
            "description": "The stream of the line"
          },
          "line": {
            "type": "string",
            "description": "One line of the log, without its line end"
          }
        },
        "required": [
          "type",
          "line"
        ],
        "additionalProperties": {}
      },
      {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "exit",
            "description": "The end of the stream"
          },
          "exitCode": {
            "type": "number",
            "description": "The exit code of docker logs"
          },
          "duration": {
            "type": "number",
            "description": "The time of the stream, in milliseconds"
          },
          "signal": {
            "description": "The signal that ended docker logs",
            "type": "string"
          },
          "timedOut": {
            "description": "True when the timeout ended the stream",
            "type": "boolean"
          },
          "aborted": {
            "description": "True when the reader or the signal ended the stream",
            "type": "boolean"
          }
        },
        "required": [
          "type",
          "exitCode",
          "duration"
        ],
        "additionalProperties": {}
      }
    ]
  }
}