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.

Selection matrix (host × target):

Host / TargetLinux imageWindows image
LinuxbuildahErr — requires Windows host
macOSbuildah (if available) else macos-sandboxErr — requires Windows host
WindowsErr — Linux peer required (WSL2 follow-up)HCS-backed native Windows builder (L-4)

If the ZLAYER_BACKEND env var is set to "buildah" or (on macOS) "sandbox", that backend is forced regardless of target OS.

§Errors

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