Skip to main content
Inspect and manage the local OCI image cache.

Image

These methods resolve the active backend with microsandbox::backend::default_backend().

Image::get()

Fetch one cached image by reference. Returns ImageNotFound when the reference is not present in the local cache.

Image::list()

Return every cached image, ordered by creation time with newest first.

Image::inspect()

Return full detail for a cached image: handle metadata, parsed OCI config fields, and layer metadata.

Image::remove()

Delete a cached image. When force is false, an image still referenced by one or more sandboxes returns ImageInUse.

Image::prune()


Image::load()

staticasync
Import images from a local archive into the cache. Accepts docker save tarballs and OCI Image Layout archives, so locally built images can be used without going through a registry. tags applies extra references to the first image in the archive. Returns a handle for every image reference imported.

Image::save()

staticasync
Export cached images to an archive file. ImageArchiveFormat selects the layout: Docker (loadable with docker load) or Oci (OCI Image Layout). Returns ImageNotFound when any reference is missing from the local cache.

Explicit local variants

Use these when your program owns a specific LocalBackend and should not depend on the process default backend.

Image::get_local()

Image::list_local()

Image::inspect_local()

Image::remove_local()

Image::prune_local()

Image::load_local()

Image::save_local()

ImageHandle

Returned by get() · list()

A lightweight metadata handle for a cached OCI image.

h.reference()

Image reference

Returns

&str

h.size_bytes()

Total image size in bytes, when known

Returns

Option<i64>

h.manifest_digest()

Content-addressable manifest digest

Returns

Option<&str>

h.architecture()

Resolved architecture

Returns

Option<&str>

h.os()

Resolved operating system

Returns

Option<&str>

h.layer_count()

Number of layers

Returns

usize

h.last_used_at()

Last referenced time

Returns

Option<DateTime<Utc>>

h.created_at()

First-pulled time

Returns

Option<DateTime<Utc>>

Types

ImageDetail

Returned by inspect()

Full detail for a cached image.

ImageConfigDetail

Used by ImageDetail.config

OCI image config fields extracted from the local cache.

ImageLayerDetail

Used by ImageDetail.layers

Metadata for one image layer.

ImagePruneReport

Returned by prune()

Summary of cached image data removed by Image::prune().

ImageArchiveFormat

enum

Used by save()

Archive layout to write when exporting images with Image::save().