Skip to content

ImageResolver

ImageResolver = (name) => Promise<UnixImage | undefined>

Defined in: packages/runtime/src/container/image-resolver.ts:43

Resolve an image reference (e.g. alpine:latest, ./my-image) to a UnixImage, or undefined when the resolver does not recognize the name.

string

Promise<UnixImage | undefined>

Implement this to resolve an image-reference string into a UnixImage that a container runtime can boot. Resolvers are the pluggable surface between container-create calls (e.g. container run alpine) and the actual in-memory image object.

Returns undefined — NOT throws — when the name is unknown. Throwing is reserved for genuine I/O / network / integrity failures; undefined is the “not mine” signal consumed by chainResolvers.

Must be pure with respect to the returned image — callers may boot the returned image immediately and multiple times without further resolver calls.

A minimal in-memory resolver backed by a registry map:

import type { ImageResolver } from '@fishnet/runtime/container/image-resolver'
import type { UnixImage } from '@fishnet/core/kernel/types'
function mapResolver(images: Map<string, UnixImage>): ImageResolver {
return async (name) => images.get(name)
}