{
  "slug": "docker-cli-output-parser",
  "name": "gizza-ai/docker-cli-output-parser",
  "version": "0.1.0",
  "title": "Docker CLI Output Parser — docker ps / images / stats to JSON, CSV or a Table — gizza.ai",
  "description": "Paste docker ps, docker images or docker stats output and get JSON, CSV, TSV, or a Markdown table. Splits CONTAINER ID, MEM USAGE / LIMIT and NET I/O correctly.",
  "tags": [
    "docker ps parser",
    "docker output to json",
    "docker stats to csv",
    "docker images to table",
    "parse docker cli output",
    "docker ps to csv",
    "docker stats json",
    "docker cli formatting"
  ],
  "category": "developer",
  "urls": {
    "page": "https://gizza.ai/tools/docker-cli-output-parser/",
    "markdown": "https://gizza.ai/tools/docker-cli-output-parser/index.md",
    "descriptor": "https://gizza.ai/tools/docker-cli-output-parser/tool.json",
    "deep_link_example": "https://gizza.ai/tools/docker-cli-output-parser/?input=CONTAINER%20ID%20%20%20IMAGE%20%20%20%20%20%20%20%20COMMAND%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20CREATED%20%20%20%20%20%20%20%20%20STATUS%20%20%20%20%20%20%20%20%20PORTS%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20NAMES%0A9f21a1b2c3d4%20%20%20nginx%3A1.25%20%20%20%22%2Fdocker-entrypoint.%E2%80%A6%22%20%20%203%20minutes%20ago%20%20%20Up%203%20minutes%20%20%200.0.0.0%3A8080-%3E80%2Ftcp%20%20%20web&kind=auto&output=json&keys=snake&parse_values=true&columns=names%2Ccpu_percent%2Cmem_usage_bytes&header=true&strict=true&limit=500"
  },
  "cli": "gizza tool docker-cli-output-parser 'CONTAINER ID   IMAGE        COMMAND                  CREATED         STATUS         PORTS                  NAMES\n9f21a1b2c3d4   nginx:1.25   \"/docker-entrypoint.…\"   3 minutes ago   Up 3 minutes   0.0.0.0:8080->80/tcp   web'",
  "tool": {
    "description": "Convert the human-readable table printed by `docker ps`, `docker images` or `docker stats` into structured data — JSON, CSV, TSV, a Markdown table, or aligned text. The header line is used as a fixed-width ruler, so column titles containing spaces (CONTAINER ID, IMAGE ID, CREATED AT, CPU %, MEM USAGE / LIMIT, NET I/O, BLOCK I/O) and cell values containing spaces (COMMAND, CREATED, STATUS, PORTS) are split at the right boundaries — unlike whitespace splitting, which mangles them. The command kind is detected from the header, or you can state it. With value parsing on (default) percentages become numbers, PIDS an integer, PORTS and NAMES arrays, and the composite MEM USAGE / LIMIT, NET I/O and BLOCK I/O columns split into separate fields with byte counts (SI kB/MB/GB and binary KiB/MiB/GiB are both understood); docker's '--' placeholders become null. Column keys can be snake_case, the printed titles, or docker's own --format template names. Pick or reorder columns, cap rows, and turn on strict mode to fail on truncated rows instead of guessing. Use it when you have pasted output or a saved log and cannot re-run the command with --format '{{json .}}'. Runs locally.",
    "parameters": {
      "additionalProperties": false,
      "properties": {
        "columns": {
          "default": "",
          "description": "Comma-separated list of columns to keep, in the order you list them. Blank (default) keeps every column. Names are matched case- and punctuation-blind, so 'CONTAINER ID', 'container_id' and 'containerid' all select the same column; derived columns such as size_bytes or mem_usage are selectable too. Example: names,cpu_percent,mem_usage_bytes.",
          "type": "string"
        },
        "header": {
          "default": true,
          "description": "Emit a header/title row for csv, tsv, markdown and table output. On by default; turn it off to append rows to an existing file. JSON output is unaffected — its keys are always present.",
          "type": "boolean"
        },
        "input": {
          "description": "The raw text printed by docker, INCLUDING the header line — the header is used as the fixed-width ruler that locates each column. Paste `docker ps`, `docker ps -a --size`, `docker images`, `docker images --digests` or `docker stats --no-stream` output as-is; a custom `--format 'table {{.ID}}\\t{{.Names}}'` header works too.",
          "type": "string"
        },
        "keys": {
          "default": "snake",
          "description": "How columns are named. 'snake' (default) is script-friendly snake_case (container_id, cpu_percent, mem_usage_limit); 'header' keeps the printed titles verbatim ('CONTAINER ID', 'MEM USAGE / LIMIT'); 'docker' uses the `--format` template names so output matches `docker ... --format '{{json .}}'` (ID, Image, CPUPerc, MemUsage, NetIO, PIDs).",
          "enum": [
            "snake",
            "header",
            "docker"
          ],
          "type": "string"
        },
        "kind": {
          "default": "auto",
          "description": "Which docker command produced the text. 'auto' (default) reads the header line: CPU %/MEM USAGE / LIMIT means stats, REPOSITORY/IMAGE ID means images, CONTAINER ID/NAMES means ps. Set it explicitly to document intent; with strict=true a mismatch between this and the header is an error.",
          "enum": [
            "auto",
            "ps",
            "images",
            "stats"
          ],
          "type": "string"
        },
        "limit": {
          "default": 500,
          "description": "Maximum number of rows to emit. Default 500, maximum 5000; extra rows are dropped from the end.",
          "maximum": 5000,
          "minimum": 1,
          "type": "integer"
        },
        "output": {
          "default": "json",
          "description": "Output shape. 'json' (default) is an array of one object per row with typed values; 'csv' and 'tsv' are RFC-4180-quoted delimited text for spreadsheets; 'markdown' is a pipe table for docs and tickets; 'table' is aligned plain text like docker's own output.",
          "enum": [
            "json",
            "csv",
            "tsv",
            "markdown",
            "table"
          ],
          "type": "string"
        },
        "parse_values": {
          "default": true,
          "description": "Type and split the values instead of returning raw strings. On (default): CPU %/MEM % become numbers, PIDS an integer, PORTS and NAMES become arrays, COMMAND is unquoted, SIZE gains size_bytes (and virtual_size when `docker ps --size` printed one), and the composite MEM USAGE / LIMIT, NET I/O and BLOCK I/O columns split into mem_usage/mem_limit, net_input/net_output, block_input/block_output plus a *_bytes count each. Docker's '--' placeholders become null. Off: every cell stays the exact text docker printed.",
          "type": "boolean"
        },
        "strict": {
          "default": false,
          "description": "Fail instead of guessing. On: a row that is truncated (no value for the last column), a tab-separated row whose field count differs from the header, or a header that disagrees with an explicit 'kind' is an error. Off (default): missing cells are filled with empty values and a mismatched kind is parsed anyway.",
          "type": "boolean"
        }
      },
      "required": [
        "input"
      ],
      "type": "object"
    }
  }
}