Container Images API¶
Images lists the Container Images advertised by a CANFAR Science Platform
Server. It inherits HTTPClient, so the same saved or runtime credential
selection applies.
Image identifiers¶
from canfar.images import Images
with Images() as images:
all_images = images.fetch() # list[str]
headless = images.fetch(kind="headless") # list[str]
print(headless)
Each string is an image identifier such as
images.canfar.net/skaha/terminal:latest. The optional kind is sent as the
server's image-type filter.
Parsed image details¶
Use details() when the digest and supported kinds are needed:
from canfar.images import Images
with Images() as images:
for image in images.details():
print(image.id, image.types, image.digest)
details() returns list[canfar.models.containers.Image]; each model has id,
types, and digest fields.
API reference¶
Bases: HTTPClient
CANFAR Image Management.
This class is a subclass of the HTTPClient class and inherits its
attributes and methods.
Examples:
>>> from canfar.images import Images
>>> images = Images()
>>> images.fetch()
Source code in canfar/images.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
details ¶
details()
Get image details from CANFAR Server.
| RETURNS | DESCRIPTION |
|---|---|
list[Image]
|
list[Image]: Parsed image details payload from the server. |
Source code in canfar/images.py
52 53 54 55 56 57 58 59 60 | |
fetch ¶
fetch(kind=None)
Get images from CANFAR Server.
| PARAMETER | DESCRIPTION |
|---|---|
kind
|
Type of image. Defaults to None.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
list[str]: A list of images on the server. |
Examples:
>>> from canfar.images import Images
>>> images = Images()
>>> images.fetch(kind="headless")
['images.canfar.net/skaha/terminal:1.1.1']
Source code in canfar/images.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |