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 / Target | Linux image | Windows image |
|---|---|---|
| Linux | buildah | Err — requires Windows host |
| macOS | buildah (if available) else macos-sandbox | Err — requires Windows host |
| Windows | Err — 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.