List
List the images of the host.
Reads each image through gohai's docker collector, which runs docker images. A host whose docker does not answer reports skipped.
osapi client node image list [flags]
Examples
# A host with an image
osapi client node image list --target web-01
Result
A host with an image, on one host:
$ osapi client node image list --target web-01 Results: HOSTNAME STATUS ID REPOSITORY TAG SIZE web-01 ok 91ef0af61f39 alpine 3.20 7.8MB 1 host: 1 ok job 550e8400-e29b-41d4-a716-446655440000 trace 26e448c9dbe1c4a8d216a98c675079c9
On each host, where one cannot run it:
$ osapi client node image list --target _all Results: HOSTNAME STATUS ID REPOSITORY TAG SIZE web-01 ok 91ef0af61f39 alpine 3.20 7.8MB web-02 ok 91ef0af61f39 alpine 3.20 7.8MB 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": [
{
"hostname": "web-01",
"id": "91ef0af61f39",
"repository": "alpine",
"size": "7.8MB",
"status": "ok",
"tag": "3.20"
}
]
}
Permission
It needs the image:read permission. osapi controller role get --name <role>
shows what a role grants.
Flags
| Flag | Description | Default |
|---|---|---|
-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.