1
0
Fork 0
mirror of https://github.com/containers/youki synced 2024-05-08 08:36:15 +02:00
youki/src/commands/start.rs
2021-10-22 21:55:16 +02:00

25 lines
579 B
Rust

//! Starts execution of the container
use std::path::PathBuf;
use anyhow::{Context, Result};
use clap::Clap;
use crate::commands::load_container;
/// Start a previously created container
#[derive(Clap, Debug)]
pub struct Start {
#[clap(required = true)]
pub container_id: String,
}
impl Start {
pub fn exec(&self, root_path: PathBuf) -> Result<()> {
let mut container = load_container(root_path, &self.container_id)?;
container
.start()
.with_context(|| format!("failed to start container {}", self.container_id))
}
}