Skip to content

Docker progress

docker_progress

Defines helpers for parsing Docker Compose's plain-progress output stdout lines

Why
  • When docker compose pull / up runs with its output piped, it emits one line per progress update (e.g. abc123 Downloading [===> ] 2MB/50MB) instead of updating layer rows in place

  • Rendering those lines into rich's Table or flet's ListView grows these objects out of bounds and makes output unreadable

How It Works

This module classifies each output line piped from a Docker Compose command so that a front-end can collapse them by layer id and colour them by status, approaching Docker's native console display

No Presentation Here
  • This module only classifies lines

  • Each front-end maps the returned kind to its own palette and renders the collapsed layers however it likes

LineKind = Literal['done', 'active', 'idle', 'free'] module-attribute

The category of a streamed line

A Docker layer that is done / active / idle, or any other free line

classify(line)

Classifies a streamed output line for collapsing and colouring

Parameters:

Name Type Description Default
line str

A single line of streamed subprocess output

required

Returns:

Type Description
LineKind

A (kind, layer_id) pair. For a Docker progress line, kind is done

str | None

/ active / idle and layer_id is the layer or service id to

tuple[LineKind, str | None]

collapse it under. For any other line, (free, None)