The Docker images of the host. osapi dsl behavior get --name image and
osapi dsl behavior method get show the same.
Behavior
| |
|---|
| Name | image |
| Description | The Docker images of the host |
| Placement | node |
| Area | containers |
| Internal | no |
| API | yes |
| CLI | yes |
| Next | no |
| Platforms | linux, darwin |
| Sudo | docker |
| Runs | docker |
| Writes | none |
| Keeps state | no |
| Uses | none |
| Used by | none |
Methods (3)
| NAME | VERB | HTTP | ROUTE | PERMISSION | DESCRIPTION |
|---|
| list | read | GET | /api/node/{hostname}/image | image:read | List the images of the host |
| pull | write | POST | /api/node/{hostname}/image/pull | image:write | Pull an image |
| delete | write | DELETE | /api/node/{hostname}/image/{image} | image:write | Remove an image |
Types (3)
| NAME | INPUT | OUTPUT |
|---|
| list | ListInput | []Entry { id, repository, tag, size } |
| pull | PullInput { image* } | PullResult { image, image_id, size, changed } |
| delete | DeleteInput { image*, force } | Result { image, changed } |
Settings (0)
None. Declare them with behavior.Config.
Telemetry
| |
|---|
| Span | behavior.image.<method> |
| Child spans | exec docker |
| Metrics | osapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total |
| Attributes | osapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed |
| Recorded inputs | image (pull, delete) |
Method list
| |
|---|
| Name | list |
| Verb | read |
| Description | List the images of the host |
| Detail | Reads each image through gohai's docker collector, which runs docker images. A host whose docker does not answer reports skipped. |
| HTTP | GET |
| Route | /api/node/{hostname}/image |
| Permission | image:read |
| Command | osapi client node image list |
| Input type | ListInput |
| Output type | []Entry |
None. The method takes no input; its command needs only --target.
Output (4)
| FIELD | TYPE | DESCRIPTION |
|---|
| id | string | The image's ID |
| repository | string | Its repository, such as alpine |
| tag | string | Its tag, such as 3.20 |
| size | string | Its size, as docker prints it, such as 7.8MB |
Examples (1)
| EXAMPLE | INPUT | OUTPUT |
|---|
| A host with an image | (none) | [id=91ef0af61f39, repository=alpine, size=7.8MB, tag=3.20] |
Method pull
| |
|---|
| Name | pull |
| Verb | write |
| Description | Pull an image |
| Detail | Runs docker pull, and answers the ID and the size of the image that the host has after it. A pull that gets nothing new, because the host had the image of that reference already, reports changed: false. |
| HTTP | POST |
| Route | /api/node/{hostname}/image/pull |
| Permission | image:execute |
| Command | osapi client node image pull |
| Input type | PullInput |
| Output type | PullResult |
| FIELD | TYPE | REQUIRED | CONSTRAINTS | DESCRIPTION |
|---|
| image | string | yes | pattern ^[a-zA-Z0-9][a-zA-Z0-9._/:@-]*$ | The image, such as alpine:3.20 |
Output (4)
| FIELD | TYPE | DESCRIPTION |
|---|
| image | string | The image |
| image_id | string | The ID of the image that the host has now |
| size | integer | Its size in bytes |
| changed | boolean | Whether the pull got a new image: false when the host had it already |
Examples (1)
| EXAMPLE | INPUT | OUTPUT |
|---|
| Pull an image | image=alpine:3.20 | image=alpine:3.20, image_id=sha256:91ef0af61f39ece4d6710e465df5ed6ca12112358344fd51ae6a3b886634148b, size=3.634816e+06, changed=true |
Method delete
| |
|---|
| Name | delete |
| Verb | write |
| Description | Remove an image |
| Detail | Runs docker rmi, with -f when force is set, which removes an image that a container uses. An image that the host does not have reports changed: false. |
| HTTP | DELETE |
| Route | /api/node/{hostname}/image/{image} |
| Permission | image:write |
| Command | osapi client node image delete |
| Input type | DeleteInput |
| Output type | Result |
| FIELD | TYPE | REQUIRED | CONSTRAINTS | DESCRIPTION |
|---|
| image | string | yes | pattern ^[a-zA-Z0-9][a-zA-Z0-9._/:@-]*$ | The image, by its reference or its ID |
| force | boolean | no | | Remove it also when a container uses it |
Output (2)
| FIELD | TYPE | DESCRIPTION |
|---|
| image | string | The image |
| changed | boolean | Whether the host changed |
Examples (2)
| EXAMPLE | INPUT | OUTPUT |
|---|
| Remove an image | image=alpine:3.20 | image=alpine:3.20, changed=true |
| An image that the host does not have | image=alpine:3.20 | image=alpine:3.20, changed=false |