pub struct ContainerSpec {
pub name: String,
pub image: String,
pub env: Vec<(String, String)>,
pub command: Option<Vec<String>>,
pub ports: Vec<PortBinding>,
pub mounts: Vec<FileMount>,
pub network_id: Option<String>,
pub aliases: Vec<String>,
pub run_id: String,
pub memory_limit_mb: Option<u64>,
pub keep_alive: bool,
pub checkpoint_ref: Option<String>,
}Expand description
Everything a backend needs to create one container. Host ports in ports are
already chosen by the core allocator (see free_ports) — a backend binds them,
it never allocates, so the same spec works identically whether the backend is a
microVM or a Docker daemon.
Fields§
§name: StringThe backend-facing container name, e.g. rz-<run_id>-<seq>.
image: StringThe image reference to run.
env: Vec<(String, String)>Environment variables, insertion-ordered — a Vec of pairs rather than a
HashMap so order and duplicate-key handling stay under the caller’s control.
command: Option<Vec<String>>The command to run instead of the image’s default entrypoint. None means “run
the image as built.”
ports: Vec<PortBinding>Already-chosen host↔guest port bindings — see the type-level doc.
mounts: Vec<FileMount>Host files/directories to mount into the guest.
network_id: Option<String>The network to join, if any.
aliases: Vec<String>DNS-style aliases this container is reachable as by other members of its network.
run_id: StringThe per-process run id (see run_id), used to label/name containers so a crashed
run’s leftovers can be told apart from a live run’s.
memory_limit_mb: Option<u64>An optional memory cap in megabytes.
keep_alive: boolMarks this container as a reuse sandbox — one meant to outlive this
process’s own lifecycle rather than be torn down by it. Defaults to false;
no builder in this crate sets it yet (reuse itself is a later wave), but every
own-run cleanup path (the reaping ledger’s .sandboxes file, the msb backend’s
started_names, the docker backend’s run-id label, this crate’s Drop-path
cleanup) already knows to leave a keep_alive spec’s container alone, so
wiring the field in now costs nothing and the reuse wave doesn’t need to touch
any of those call sites again.
checkpoint_ref: Option<String>Set by crate::Container::from_checkpoint to the source crate::Checkpoint’s
ref — the checkpoint feature’s own signal to the backend that this spec’s
image is a checkpoint reference, not an ordinary image. docker ignores this
(the ref already IS a normal image tag; the ordinary create path just works);
microsandbox, when this is set, boots via msb run --snapshot <ref>
instead of its normal image boot, keeping every other flag identical.
Deliberately NOT part of the reuse identity hash — reuse and
from_checkpoint are not a supported combination (see
RightsizeError::ReuseCheckpointConflict). Defaults to None.
Implementations§
Trait Implementations§
Source§impl Clone for ContainerSpec
impl Clone for ContainerSpec
Source§fn clone(&self) -> ContainerSpec
fn clone(&self) -> ContainerSpec
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more