liboci_cli/create.rs
1//! Handles the creation of a new container
2use std::path::PathBuf;
3
4use clap::Parser;
5
6/// Create a container
7/// Reference: https://github.com/opencontainers/runc/blob/main/man/runc-create.8.md
8#[derive(Parser, Debug)]
9pub struct Create {
10 /// Path to the bundle directory, containing config.json and root filesystem
11 #[clap(short, long, default_value = ".")]
12 pub bundle: PathBuf,
13 /// Unix socket (file) path , which will receive file descriptor of the writing end of the pseudoterminal
14 #[clap(short, long)]
15 pub console_socket: Option<PathBuf>,
16 /// File to write pid of the container created
17 // note that in the end, container is just another process
18 #[clap(short, long)]
19 pub pid_file: Option<PathBuf>,
20 /// Do not use pivot rool to jail process inside rootfs
21 #[clap(long)]
22 pub no_pivot: bool,
23 /// Do not create a new session keyring for the container.
24 #[clap(long)]
25 pub no_new_keyring: bool,
26 /// Pass N additional file descriptors to the container (stdio + $LISTEN_FDS + N in total)
27 #[clap(long, default_value = "0")]
28 pub preserve_fds: i32,
29
30 /// Name of the container instance to be started
31 #[clap(value_parser = clap::builder::NonEmptyStringValueParser::new(), required = true)]
32 pub container_id: String,
33}