images

Model and Manager for Image resources.

class Image(attrs: Mapping[str, Any] | None = None, client: APIClient | None = None, collection: Manager | None = None)[source]

Bases: PodmanResource

Details and configuration for an Image managed by the Podman service.

Initialize base class for PodmanResource’s.

Parameters:
  • attrs – Mapping of attributes for resource from Podman service.

  • client – Configured connection to a Podman service.

  • collection – Manager of this category of resource, named collection for compatibility

history() List[Dict[str, Any]][source]

Returns history of the Image.

Raises:

APIError – when service returns an error

reload() None

Refresh this object’s data from the service.

remove(**kwargs) List[Dict[Literal['Deleted', 'Untagged', 'Errors', 'ExitCode'], str | int]][source]

Delete image from Podman service.

Podman only

Keyword Arguments:
  • force – Delete Image even if in use

  • noprune – Ignored.

Returns:

Report on which images were deleted and untagged, including any reported errors.

Raises:
  • ImageNotFound – when image does not exist

  • APIError – when service returns an error

save(chunk_size: int | None = 2097152, named: str | bool = False) Iterator[bytes][source]

Returns Image as tarball.

Format is set to docker-archive, this allows load() to import this tarball.

Parameters:
  • chunk_size – If None, data will be streamed in received buffer size. If not None, data will be returned in sized buffers. Default: 2MB

  • named – Ignored.

Raises:

APIError – when service returns an error

tag(repository: str, tag: str | None, force: bool = False) bool[source]

Tag Image into repository.

Parameters:
  • repository – The repository for tagging Image.

  • tag – optional tag name.

  • force – Ignore client errors

Returns:

True, when operational succeeds.

Raises:
  • ImageNotFound – when service cannot find image

  • APIError – when service returns an error

property id

Returns the identifier for the object.

Type:

str

property labels

Return labels associated with Image.

Type:

dict[str, str]

property short_id

Returns truncated identifier. ‘sha256’ preserved when included in the id.

No attempt is made to ensure the returned value is semantically meaningful for all resources.

Type:

str

property tags

Return tags from Image.

Type:

list[str]