Skip to main content

Container image

The Docker images of the host. osapi dsl behavior get --name image and osapi dsl behavior method get show the same.

Behavior​

Nameimage
DescriptionThe Docker images of the host
Placementnode
Areacontainers
Internalno
APIyes
CLIyes
Nextno
Platformslinux, darwin
Sudodocker
Runsdocker
Writesnone
Keeps stateno
Usesnone
Used bynone

Methods (3)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
listreadGET/api/node/{hostname}/imageimage:readList the images of the host
pullwritePOST/api/node/{hostname}/image/pullimage:writePull an image
deletewriteDELETE/api/node/{hostname}/image/{image}image:writeRemove an image

Types (3)​

NAMEINPUTOUTPUT
listListInput[]Entry { id, repository, tag, size }
pullPullInput { image* }PullResult { image, image_id, size, changed }
deleteDeleteInput { image*, force }Result { image, changed }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.image.<method>
Child spansexec docker
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputsimage (pull, delete)

Method list​

Namelist
Verbread
DescriptionList the images of the host
DetailReads each image through gohai's docker collector, which runs docker images. A host whose docker does not answer reports skipped.
HTTPGET
Route/api/node/{hostname}/image
Permissionimage:read
Commandosapi client node image list
Input typeListInput
Output type[]Entry

Input (0)​

None. The method takes no input; its command needs only --target.

Output (4)​

FIELDTYPEDESCRIPTION
idstringThe image's ID
repositorystringIts repository, such as alpine
tagstringIts tag, such as 3.20
sizestringIts size, as docker prints it, such as 7.8MB

Examples (1)​

EXAMPLEINPUTOUTPUT
A host with an image(none)[id=91ef0af61f39, repository=alpine, size=7.8MB, tag=3.20]

Method pull​

Namepull
Verbwrite
DescriptionPull an image
DetailRuns 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.
HTTPPOST
Route/api/node/{hostname}/image/pull
Permissionimage:execute
Commandosapi client node image pull
Input typePullInput
Output typePullResult

Input (1)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
imagestringyespattern ^[a-zA-Z0-9][a-zA-Z0-9._/:@-]*$The image, such as alpine:3.20

Output (4)​

FIELDTYPEDESCRIPTION
imagestringThe image
image_idstringThe ID of the image that the host has now
sizeintegerIts size in bytes
changedbooleanWhether the pull got a new image: false when the host had it already

Examples (1)​

EXAMPLEINPUTOUTPUT
Pull an imageimage=alpine:3.20image=alpine:3.20, image_id=sha256:91ef0af61f39ece4d6710e465df5ed6ca12112358344fd51ae6a3b886634148b, size=3.634816e+06, changed=true

Method delete​

Namedelete
Verbwrite
DescriptionRemove an image
DetailRuns 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.
HTTPDELETE
Route/api/node/{hostname}/image/{image}
Permissionimage:write
Commandosapi client node image delete
Input typeDeleteInput
Output typeResult

Input (2)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
imagestringyespattern ^[a-zA-Z0-9][a-zA-Z0-9._/:@-]*$The image, by its reference or its ID
forcebooleannoRemove it also when a container uses it

Output (2)​

FIELDTYPEDESCRIPTION
imagestringThe image
changedbooleanWhether the host changed

Examples (2)​

EXAMPLEINPUTOUTPUT
Remove an imageimage=alpine:3.20image=alpine:3.20, changed=true
An image that the host does not haveimage=alpine:3.20image=alpine:3.20, changed=false