...
This commit is contained in:
@@ -1,37 +1,38 @@
|
||||
|
||||
use crate::virt::buildah::execute_buildah_command;
|
||||
use crate::process::CommandResult;
|
||||
use super::BuildahError;
|
||||
|
||||
/// Create a container from an image
|
||||
pub fn build_from(image: &str) -> Dynamic {
|
||||
pub fn from(image: &str) -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["from", image])
|
||||
}
|
||||
|
||||
/// Run a command in a container
|
||||
pub fn build_run(container: &str, command: &str) -> Dynamic {
|
||||
pub fn run(container: &str, command: &str) -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["run", container, "sh", "-c", command])
|
||||
}
|
||||
|
||||
/// Copy files into a container
|
||||
pub fn build_copy(container: &str, source: &str, dest: &str) -> Dynamic {
|
||||
pub fn copy(container: &str, source: &str, dest: &str) -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["copy", container, source, dest])
|
||||
}
|
||||
|
||||
pub fn build_add(container: &str, source: &str, dest: &str) -> Dynamic {
|
||||
pub fn add(container: &str, source: &str, dest: &str) -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["add", container, source, dest])
|
||||
}
|
||||
|
||||
/// Commit a container to an image
|
||||
pub fn build_commit(container: &str, image_name: &str) -> Dynamic {
|
||||
pub fn commit(container: &str, image_name: &str) -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["commit", container, image_name])
|
||||
}
|
||||
|
||||
|
||||
/// Remove a container
|
||||
pub fn build_remove(container: &str) -> Dynamic {
|
||||
pub fn remove(container: &str) -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["rm", container])
|
||||
}
|
||||
|
||||
/// List containers
|
||||
pub fn build_list() -> Dynamic {
|
||||
pub fn list() -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["containers"])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user