A Docker Swarm task is a single container instance scheduled as part of a service — the atomic unit of swarm scheduling. Tasks are created and destroyed by the swarm scheduler; you cannot directly create tasks, but you can list them, inspect their state, and stream their logs. All methods areDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/fussybeaver/bollard/llms.txt
Use this file to discover all available pages before exploring further.
async (except the streaming task_logs) and return Result<T, bollard::errors::Error>.
Swarm mode must be enabled and the daemon must be a manager node to access task information.
list_tasks
Return all tasks visible to the swarm manager, with optional filtering.
Options — ListTasksOptionsBuilder
| Builder method | Description |
|---|---|
.filters(&HashMap<&str, Vec<&str>>) | Filter by desired-state (running | shutdown | accepted), id, label, name, node, or service. |
Returns
Result<Vec<Task>, Error>
Example
inspect_task
Fetch full details for a single task by its ID.
Returns
Result<Task, Error> — a Task model containing id, version, created_at, updated_at, spec, status (including state and message), node_id, and service_id.
Example
task_logs
Stream stdout and/or stderr log output from a specific task. Returns a Stream of LogOutput items, allowing incremental processing of potentially large or live log feeds.
Options — LogsOptionsBuilder
| Builder method | Type | Description |
|---|---|---|
.stdout(bool) | bool | Include stdout output. |
.stderr(bool) | bool | Include stderr output. |
.follow(bool) | bool | Keep the stream open and deliver new lines as they appear. |
.timestamps(bool) | bool | Prefix each log line with an RFC 3339 timestamp. |
.since(i64) | i64 | Show only logs since this Unix timestamp. |
.tail(&str) | &str | Return only the last N lines, e.g. "100" or "all". |
.details(bool) | bool | Include extra details provided to logs. |
Returns
impl Stream<Item = Result<LogOutput, Error>>
Each LogOutput variant is one of StdOut, StdErr, or Console and implements Display to produce the log line text.
