pub struct LinuxBuilder { /* private fields */ }Expand description
Boots an OCI image as a Linux microVM (bsdkrun linux).
Implementations§
Source§impl LinuxBuilder
impl LinuxBuilder
Sourcepub fn port(self, forward: impl Into<String>) -> Self
pub fn port(self, forward: impl Into<String>) -> Self
Add a host->guest TCP port forward, "HOST:GUEST".
Sourcepub fn forward(self, host: u16, guest: u16) -> Self
pub fn forward(self, host: u16, guest: u16) -> Self
Add a port forward from numbers instead of a string.
Sourcepub fn log_level(self, level: u32) -> Self
pub fn log_level(self, level: u32) -> Self
bsdkrun’s global --log-level for the create call (default 1, so
boot diagnostics land in the error when a boot fails).
Sourcepub fn to_args(&self) -> Vec<String>
pub fn to_args(&self) -> Vec<String>
The exact argv create() will run (minus the binary and global
flags) — for inspection and tests.
Sourcepub fn kernel_version(self, version: impl Into<String>) -> Self
pub fn kernel_version(self, version: impl Into<String>) -> Self
Kernel version to fetch (--kernel-version).
Sourcepub fn volume(self, name: impl Into<String>) -> Self
pub fn volume(self, name: impl Into<String>) -> Self
Use a persistent CoW volume as the rootfs (-v).
Sourcepub fn mount(self, mount: impl Into<String>) -> Self
pub fn mount(self, mount: impl Into<String>) -> Self
Share a host directory into the guest, "HOST:GUEST" or
"HOST:GUEST:ro" (--mount, repeatable).
Sourcepub fn attach_disk(self, disk: impl Into<String>) -> Self
pub fn attach_disk(self, disk: impl Into<String>) -> Self
Attach an extra raw disk as virtio-blk, "PATH" or "PATH:ro"
(--attach-disk, repeatable). With the default virtio-fs rootfs the
first attachment is the guest’s /dev/vda — format and mount it in the
guest for native-speed I/O.
Sourcepub fn entrypoint(self, entrypoint: impl Into<String>) -> Self
pub fn entrypoint(self, entrypoint: impl Into<String>) -> Self
Override the image entrypoint (--entrypoint).
Sourcepub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Set an environment variable for the guest’s entrypoint (-e K=V,
repeatable). Merged over the image’s own config, so a key the image
already defines is replaced rather than duplicated.
Sourcepub fn envs<K, V>(self, vars: impl IntoIterator<Item = (K, V)>) -> Self
pub fn envs<K, V>(self, vars: impl IntoIterator<Item = (K, V)>) -> Self
Set several environment variables at once.
Trait Implementations§
Source§impl Clone for LinuxBuilder
impl Clone for LinuxBuilder
Source§fn clone(&self) -> LinuxBuilder
fn clone(&self) -> LinuxBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more