pub struct OciContainer {
pub id: String,
pub state: OciLifecycleState,
pub config: OciConfig,
pub pid: u64,
pub bundle: String,
pub created_at: u64,
}Expand description
An OCI-compliant container runtime instance.
Fields§
§id: StringUnique container ID.
state: OciLifecycleStateCurrent lifecycle state.
config: OciConfigParsed OCI configuration.
pid: u64PID of the container init process (0 if not started).
bundle: StringBundle path (directory containing config.json + rootfs).
created_at: u64Creation timestamp (monotonic counter value).
Implementations§
Source§impl OciContainer
impl OciContainer
Sourcepub fn new(
id: &str,
bundle: &str,
config: OciConfig,
) -> Result<Self, KernelError>
pub fn new( id: &str, bundle: &str, config: OciConfig, ) -> Result<Self, KernelError>
Create a new container from a parsed config.
Sourcepub fn mark_created(&mut self) -> Result<(), KernelError>
pub fn mark_created(&mut self) -> Result<(), KernelError>
Transition to Created state (namespaces set up, hooks run).
Sourcepub fn start(&mut self, pid: u64) -> Result<(), KernelError>
pub fn start(&mut self, pid: u64) -> Result<(), KernelError>
Start the container process, transitioning to Running.
Sourcepub fn stop(&mut self) -> Result<(), KernelError>
pub fn stop(&mut self) -> Result<(), KernelError>
Transition to Stopped state.
Sourcepub fn pivot_root(&self) -> Result<(String, String), KernelError>
pub fn pivot_root(&self) -> Result<(String, String), KernelError>
Perform pivot_root: change the root filesystem for the container. Returns the old root path and new root path.