Struct libcontainer::container::Container
source · pub struct Container {
pub state: State,
pub root: PathBuf,
}Expand description
Structure representing the container data
Fields§
§state: State§root: PathBufImplementations§
source§impl Container
impl Container
pub fn new( container_id: &str, status: ContainerStatus, pid: Option<i32>, bundle: &Path, container_root: &Path, ) -> Result<Self, LibcontainerError>
pub fn id(&self) -> &str
pub fn can_start(&self) -> bool
pub fn can_kill(&self) -> bool
pub fn can_delete(&self) -> bool
pub fn can_exec(&self) -> bool
pub fn can_pause(&self) -> bool
pub fn can_resume(&self) -> bool
pub fn bundle(&self) -> &PathBuf
pub fn set_annotations( &mut self, annotations: Option<HashMap<String, String>>, ) -> &mut Self
pub fn pid(&self) -> Option<Pid>
pub fn set_pid(&mut self, pid: i32) -> &mut Self
pub fn created(&self) -> Option<DateTime<Utc>>
pub fn creator(&self) -> Option<OsString>
pub fn set_creator(&mut self, uid: u32) -> &mut Self
pub fn systemd(&self) -> bool
pub fn set_systemd(&mut self, should_use: bool) -> &mut Self
pub fn set_clean_up_intel_rdt_directory(&mut self, clean_up: bool) -> &mut Self
pub fn clean_up_intel_rdt_subdirectory(&self) -> Option<bool>
pub fn status(&self) -> ContainerStatus
pub fn set_status(&mut self, status: ContainerStatus) -> &mut Self
pub fn refresh_status(&mut self) -> Result<(), LibcontainerError>
pub fn refresh_state(&mut self) -> Result<&mut Self, LibcontainerError>
pub fn load(container_root: PathBuf) -> Result<Self, LibcontainerError>
pub fn save(&self) -> Result<(), LibcontainerError>
pub fn spec(&self) -> Result<YoukiConfig, LibcontainerError>
source§impl Container
impl Container
pub fn checkpoint( &mut self, opts: &CheckpointOptions, ) -> Result<(), LibcontainerError>
source§impl Container
impl Container
sourcepub fn delete(&mut self, force: bool) -> Result<(), LibcontainerError>
pub fn delete(&mut self, force: bool) -> Result<(), LibcontainerError>
Deletes the container
§Example
use libcontainer::container::builder::ContainerBuilder;
use libcontainer::syscall::syscall::SyscallType;
let mut container = ContainerBuilder::new(
"74f1a4cb3801".to_owned(),
SyscallType::default(),
)
.as_init("/var/run/docker/bundle")
.build()?;
container.delete(true)?;source§impl Container
impl Container
sourcepub fn events(
&mut self,
interval: u32,
stats: bool,
) -> Result<(), LibcontainerError>
pub fn events( &mut self, interval: u32, stats: bool, ) -> Result<(), LibcontainerError>
Displays container events
§Example
use libcontainer::container::builder::ContainerBuilder;
use libcontainer::syscall::syscall::SyscallType;
let mut container = ContainerBuilder::new(
"74f1a4cb3801".to_owned(),
SyscallType::default(),
)
.as_init("/var/run/docker/bundle")
.build()?;
container.events(5000, false)?;source§impl Container
impl Container
sourcepub fn kill<S: Into<Signal>>(
&mut self,
signal: S,
all: bool,
) -> Result<(), LibcontainerError>
pub fn kill<S: Into<Signal>>( &mut self, signal: S, all: bool, ) -> Result<(), LibcontainerError>
Sends the specified signal to the container init process
§Example
use libcontainer::container::builder::ContainerBuilder;
use libcontainer::syscall::syscall::SyscallType;
use nix::sys::signal::Signal;
let mut container = ContainerBuilder::new(
"74f1a4cb3801".to_owned(),
SyscallType::default(),
)
.as_init("/var/run/docker/bundle")
.build()?;
container.kill(Signal::SIGKILL, false)?;source§impl Container
impl Container
sourcepub fn pause(&mut self) -> Result<(), LibcontainerError>
pub fn pause(&mut self) -> Result<(), LibcontainerError>
Suspends all processes within the container
§Example
use libcontainer::container::builder::ContainerBuilder;
use libcontainer::syscall::syscall::SyscallType;
let mut container = ContainerBuilder::new(
"74f1a4cb3801".to_owned(),
SyscallType::default(),
)
.as_init("/var/run/docker/bundle")
.build()?;
container.pause()?;source§impl Container
impl Container
sourcepub fn resume(&mut self) -> Result<(), LibcontainerError>
pub fn resume(&mut self) -> Result<(), LibcontainerError>
Resumes all processes within the container
§Example
use libcontainer::container::builder::ContainerBuilder;
use libcontainer::syscall::syscall::SyscallType;
let mut container = ContainerBuilder::new(
"74f1a4cb3801".to_owned(),
SyscallType::default(),
)
.as_init("/var/run/docker/bundle")
.build()?;
container.resume()?;source§impl Container
impl Container
sourcepub fn start(&mut self) -> Result<(), LibcontainerError>
pub fn start(&mut self) -> Result<(), LibcontainerError>
Starts a previously created container
§Example
use libcontainer::container::builder::ContainerBuilder;
use libcontainer::syscall::syscall::SyscallType;
let mut container = ContainerBuilder::new(
"74f1a4cb3801".to_owned(),
SyscallType::default(),
)
.as_init("/var/run/docker/bundle")
.build()?;
container.start();Trait Implementations§
Auto Trait Implementations§
impl Freeze for Container
impl RefUnwindSafe for Container
impl Send for Container
impl Sync for Container
impl Unpin for Container
impl UnwindSafe for Container
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)