docs.rs failed to build firecracker-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Firecracker Rust Client SDK
Rust SDK for the Firecracker microVM API.
Crates
| Crate | Description |
|---|---|
firecracker |
Facade — re-exports api + sdk + optional runtime |
fc-api |
Low-level typed client, generated from Swagger spec via progenitor |
fc-sdk |
High-level typestate wrapper: VmBuilder → Vm lifecycle, process management |
fc-cli |
CLI for runtime helpers and microVM process launch |
Quick Start
use ;
let vm = new
.boot_source
.machine_config
.start
.await?;
vm.pause.await?;
vm.resume.await?;
vm.create_snapshot.await?;
For operations not covered by the SDK, use the generated API client directly:
let client = vm.client;
client.describe_instance.send.await?;
Process Management
fc-sdk can spawn and manage the Firecracker process for you.
Direct (no jailer)
use FirecrackerProcessBuilder;
let process = new
.id
.no_seccomp
.cleanup_socket
.spawn
.await?;
let vm = process.vm_builder
.boot_source
.machine_config
.start
.await?;
// process is killed and socket cleaned up on drop
Via Jailer
use JailerProcessBuilder;
let process = new
.netns
.spawn
.await?;
// Socket path is automatically computed from the chroot layout
let vm = process.vm_builder
.boot_source
.machine_config
.start
.await?;
Restoring from Snapshot
use ;
let vm = restore.await?;
Rebuilding from Exported Config
// Export config from a running VM
let config = vm.config.await?;
// Recreate a builder on a new Firecracker instance
let new_vm = from_config
.mmds_data
.start
.await?;
Bundled Runtime Mode
Enable this capability with:
firecracker::runtime::bundled supports resolving firecracker and jailer binaries from bundled
Firecracker upstream release artifacts with optional fallback to system PATH.
Release-based bundled mode currently supports:
linux-x86_64linux-aarch64
use ;
let bundled = new
.mode
.bundle_root
.release_version
.firecracker_sha256
.jailer_sha256;
let fc = bundled.firecracker_builder?;
let jailer = bundled.jailer_builder?;
Supported bundled path layout:
{bundle_root}/release-vX.Y.Z-{arch}/firecracker-vX.Y.Z-{arch}{bundle_root}/release-vX.Y.Z-{arch}/jailer-vX.Y.Z-{arch}{bundle_root}/firecracker-vX.Y.Z-{arch}{bundle_root}/jailer-vX.Y.Z-{arch}{bundle_root}/{os}-{arch}/{binary}{bundle_root}/{os}-{arch}/bin/{binary}{bundle_root}/{arch}-{os}/{binary}{bundle_root}/{arch}-{os}/bin/{binary}{bundle_root}/{binary}
Environment variable overrides:
FC_SDK_FIRECRACKER_BINFC_SDK_JAILER_BINFC_SDK_BUNDLED_DIRFC_SDK_FIRECRACKER_RELEASE
fc-cli usage examples:
# Resolve both binaries using bundled-first strategy
# Resolve only firecracker from system PATH
# Start a microVM and keep fc-cli attached (Ctrl+C to stop)
# Start a microVM in detached mode
# Start a microVM via jailer in detached mode
# Show platform support for release-based bundled mode
fc-cli start notes:
--backend firecracker: uses--socket-path(default/tmp/firecracker.socket).--backend jailer: requires--uidand--gid; custom--socket-pathis not supported.--backend jailer --daemonize: must be used together with--detach.--detach: leaves the process running and printssocketplus best-effortpid.- default (without
--detach): keepsfc-cliattached; pressCtrl+Cfor graceful shutdown.
Building
Requires Node.js (for npx swagger2openapi during code generation).
License
MIT OR Apache-2.0