Skip to main content

detect_backend

Function detect_backend 

Source
pub async fn detect_backend(target_os: ImageOs) -> Result<Arc<dyn BuildBackend>>
Expand description

Auto-detect the best available build backend for the given target OS.

Thin wrapper around detect_backend_with_options that passes options = None. Use this from call sites that have no access to a BuildOptions (early-construction probes, pipeline scaffolding) and therefore can only consult ZLAYER_BACKEND + the auto-detect matrix.

Selection matrix (host × target), when no override is set:

Host / TargetLinux imageWindows imageDarwin image
Linuxbuildah-sidecar if available, else buildah-cliErr — requires Windows hostErr — requires macOS host
macOSVZ buildah sidecar / buildah-cli (no sandbox fallback)Err — requires Windows hostSeatbelt sandbox backend
WindowsErr — Linux peer required (WSL2 follow-up)HCS-backed native Windows builder (L-4)Err — requires macOS host

§Errors

Returns an error if the host cannot build images for the requested target_os, or if the selected backend’s tooling is missing.