This commit is contained in:
2025-04-02 08:55:54 +02:00
parent c7908cb6e4
commit 6cc05ad2eb
6 changed files with 39 additions and 764 deletions

View File

@@ -0,0 +1,37 @@
use crate::virt::buildah::execute_buildah_command;
/// Create a container from an image
pub fn build_from(image: &str) -> Dynamic {
execute_buildah_command(&["from", image])
}
/// Run a command in a container
pub fn build_run(container: &str, command: &str) -> Dynamic {
execute_buildah_command(&["run", container, "sh", "-c", command])
}
/// Copy files into a container
pub fn build_copy(container: &str, source: &str, dest: &str) -> Dynamic {
execute_buildah_command(&["copy", container, source, dest])
}
pub fn build_add(container: &str, source: &str, dest: &str) -> Dynamic {
execute_buildah_command(&["add", container, source, dest])
}
/// Commit a container to an image
pub fn build_commit(container: &str, image_name: &str) -> Dynamic {
execute_buildah_command(&["commit", container, image_name])
}
/// Remove a container
pub fn build_remove(container: &str) -> Dynamic {
execute_buildah_command(&["rm", container])
}
/// List containers
pub fn build_list() -> Dynamic {
execute_buildah_command(&["containers"])
}