added isolation feature for running containers
This commit is contained in:
@@ -8,10 +8,26 @@ pub fn from(image: &str) -> Result<CommandResult, BuildahError> {
|
||||
}
|
||||
|
||||
/// Run a command in a container
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `container` - The container ID or name
|
||||
/// * `command` - The command to run
|
||||
pub fn run(container: &str, command: &str) -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["run", container, "sh", "-c", command])
|
||||
}
|
||||
|
||||
/// Run a command in a container with specified isolation
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `container` - The container ID or name
|
||||
/// * `command` - The command to run
|
||||
/// * `isolation` - Isolation method (e.g., "chroot", "rootless", "oci")
|
||||
pub fn run_with_isolation(container: &str, command: &str, isolation: &str) -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["run", "--isolation", isolation, container, "sh", "-c", command])
|
||||
}
|
||||
|
||||
/// Copy files into a container
|
||||
pub fn copy(container: &str, source: &str, dest: &str) -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["copy", container, source, dest])
|
||||
|
||||
Reference in New Issue
Block a user