$ dok ps
List containers, grouped by compose project
Synopsis
dok ps [OPTIONS]Description
Lists containers grouped by compose project, showing the service name rather than the container name compose generates. Each row carries a short id, a state dot, a health mark when the container runs a healthcheck, published ports as :host→container, and a relative age.
Columns shrink to fit the terminal instead of wrapping. Long names, images and port lists are capped at a share of the width and truncated past it, so one outlier cannot push the rest of the table off screen.
Options
-a, --all- Include stopped containers
--flat- Do not group by compose project
-f, --filter <FILTER>- Only containers whose name or image matches
-s, --sort <SORT>- Sort key
Every command also takes the global options: --json, --color, --icons and --theme.
Examples
$ dok ps # running containers, grouped by project$ dok ps -a # include stopped containers$ dok ps --flat -s age # one flat list, newest first$ dok ps -f postgres # only rows whose name or image matchesOutput
dok ps --demo, dok’s built-in example stack.JSON output
$ dok ps -a --json
{
"containers": [
{
"created": {
"age_human": "6d",
"age_seconds": 518400,
"created": 1789984650
},
"health": "healthy",
"id": "a1b2c3d4e5f6",
"image": "ghcr.io/demo-shop/api:1.4.2",
"name": "demo-shop-api-1",
"ports": [
{
"container_port": 3000,
"host_ip": "0.0.0.0",
"host_port": 8080,
"protocol": "tcp"
}
],
"project": "demo-shop",
"service": "api",
"short_id": "a1b2c3d4e5f6",
"state": "running",
"status": "Up 3 hours (healthy)"
},
{
"created": {
"age_human": "6d",
"age_seconds": 518400,
"created": 1789984650
},
"health": "healthy",
"id": "c3d4e5f6a1b2",
"image": "postgres:16-alpine",
"name": "demo-shop-postgres-1",
"ports": [
{
"container_port": 5432,
"host_ip": "127.0.0.1",
"host_port": 5432,
"protocol": "tcp"
}
],
"project": "demo-shop",
"service": "postgres",
"short_id": "c3d4e5f6a1b2",
"state": "running",
"status": "Up 3 hours (healthy)"
}
]
}Longer arrays are cut to their first two elements here.
See also
dok-ports(1), dok-health(1), dok-inspect(1), dok-tree(1), dok(7)
dok 0.3.02026-09-27DOK-PS(1)