Get
Get one container.
Reads one container by its name, its ID or the start of its ID. A container that the host does not have is not found.
osapi client node docker get [flags]
Examples
# A container
osapi client node docker get --target web-01 --name osapitest
Result
A container, on one host:
$ osapi client node docker get --target web-01 --name osapitest Results: HOSTNAME STATUS ID NAME IMAGE STATE SUMMARY CREATED HEALTH PORTS MOUNTS NETWORKS ENV NAMES web-01 ok 3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7 osapitest alpine:3.20 running Up 2 minutes 2026-11-22 10:00:00 0.0.0.0:8080->80/tcp /srv/data:/data:ro bridge 172.17.0.2 via 172.17.0.1 PATH, APP_TOKEN 1 host: 1 ok job 550e8400-e29b-41d4-a716-446655440000 trace 26e448c9dbe1c4a8d216a98c675079c9
On each host, where one cannot run it:
$ osapi client node docker get --target _all --name osapitest Results: HOSTNAME STATUS ID NAME IMAGE STATE SUMMARY CREATED HEALTH PORTS MOUNTS NETWORKS ENV NAMES web-01 ok 3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7 osapitest alpine:3.20 running Up 2 minutes 2026-11-22 10:00:00 0.0.0.0:8080->80/tcp /srv/data:/data:ro bridge 172.17.0.2 via 172.17.0.1 PATH, APP_TOKEN web-02 ok 3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7 osapitest alpine:3.20 running Up 2 minutes 2026-11-22 10:00:00 0.0.0.0:8080->80/tcp /srv/data:/data:ro bridge 172.17.0.2 via 172.17.0.1 PATH, APP_TOKEN 3 hosts: 2 ok, 1 skipped job 550e8400-e29b-41d4-a716-446655440000 trace 26e448c9dbe1c4a8d216a98c675079c9 Details: mac-01 skipped operation not supported on this OS family
With --json, the API's response:
{
"job_id": "550e8400-e29b-41d4-a716-446655440000",
"results": [
{
"created": "2026-11-22T10:00:00Z",
"env_names": ["PATH", "APP_TOKEN"],
"hostname": "web-01",
"id": "3f4e8a1b2c5d6e7f8091a2b3c4d5e6f708192a3b4c5d6e7f8091a2b3c4d5e6f7",
"image": "alpine:3.20",
"mounts": ["/srv/data:/data:ro"],
"name": "osapitest",
"networks": ["bridge 172.17.0.2 via 172.17.0.1"],
"ports": ["0.0.0.0:8080-\u003e80/tcp"],
"state": "running",
"status": "ok",
"summary": "Up 2 minutes"
}
]
}
The command fails in these cases:
| Call | Flags | Fails with |
|---|---|---|
| A container that the host does not have | --name nothere | not found |
| A name that is an option | --name -f | container_id |
Permission
It needs the docker:read permission. osapi controller role get --name <role>
shows what a role grants.
Flags
| Flag | Description | Default |
|---|---|---|
--name | The container's name or ID (required) | |
-T, --target | Target: _all, _any, hostname, or label (group:web.dev) | _all |
Global flags
| Flag | Description | Default |
|---|---|---|
-d, --debug | Enable or disable debug mode | |
-j, --json | Enable JSON output | |
-f, --osapi-file | Path to config file; without one at the default path, osapi runs on the defaults | /etc/osapi/osapi.yaml |
--url | Base URL the CLI client connects to (controller.client.url) | https://localhost:8080 |
Output tells how the result is printed, and what --json
gives.