Skip to main content

Pull

Pull an image.

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.

osapi client node image pull [flags]

Examples​

# Pull an image
osapi client node image pull --target web-01 --image alpine:3.20

Result​

Pull an image, on one host:

$ osapi client node image pull --target web-01 --image alpine:3.20
Results:
  HOSTNAME  STATUS   IMAGE        IMAGE ID                                                                 SIZE
  web-01    changed  alpine:3.20  sha256:91ef0af61f39ece4d6710e465df5ed6ca12112358344fd51ae6a3b886634148b  3634816

  1 host: 1 changed   job 550e8400-e29b-41d4-a716-446655440000   trace 26e448c9dbe1c4a8d216a98c675079c9

On each host, where one cannot run it:

$ osapi client node image pull --target _all --image alpine:3.20
Results:
  HOSTNAME  STATUS   IMAGE        IMAGE ID                                                                 SIZE
  web-01    changed  alpine:3.20  sha256:91ef0af61f39ece4d6710e465df5ed6ca12112358344fd51ae6a3b886634148b  3634816
  web-02    changed  alpine:3.20  sha256:91ef0af61f39ece4d6710e465df5ed6ca12112358344fd51ae6a3b886634148b  3634816

  3 hosts: 2 changed, 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": [
{
"changed": true,
"hostname": "web-01",
"image": "alpine:3.20",
"image_id": "sha256:91ef0af61f39ece4d6710e465df5ed6ca12112358344fd51ae6a3b886634148b",
"size": 3634816,
"status": "ok"
}
]
}

With the default settings, each example does this on the host:

ExampleOn the host
Pull an imageruns docker pull alpine:3.20

The command fails in these cases:

CallFlagsFails with
An image that is an option--image --all-tagsimage_ref
No imagerequired

Permission​

It needs the image:execute permission. osapi controller role get --name <role> shows what a role grants.

Flags​

FlagDescriptionDefault
--imageThe image, such as alpine:3.20 (required)
-T, --targetTarget: _all, _any, hostname, or label (group:web.dev)_all

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file; without one at the default path, osapi runs on the defaults/etc/osapi/osapi.yaml
--urlBase URL the CLI client connects to (controller.client.url)https://localhost:8080

Output tells how the result is printed, and what --json gives.