Skip to main content

Builder

Struct Builder 

Source
pub struct Builder { /* private fields */ }
Expand description

Builder struct for buildah operations

Implementations§

Source§

impl Builder

Source

pub fn new(name: &str, image: &str) -> Result<Self, BuildahError>

Create a new builder with a container from the specified image

§Arguments
  • name - Name for the container
  • image - Image to create the container from
§Returns
  • Result<Self, BuildahError> - Builder instance or error
Source

pub fn container_id(&self) -> Option<&String>

Get the container ID

Source

pub fn name(&self) -> &str

Get the container name

Source

pub fn debug(&self) -> bool

Get the debug mode

Source

pub fn set_debug(&mut self, debug: bool) -> &mut Self

Set the debug mode

Source

pub fn image(&self) -> &str

Get the base image

Source

pub fn run(&self, command: &str) -> Result<CommandResult, BuildahError>

Run a command in the container

§Arguments
  • command - The command to run
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn run_with_isolation( &self, command: &str, isolation: &str, ) -> Result<CommandResult, BuildahError>

Run a command in the container with specified isolation

§Arguments
  • command - The command to run
  • isolation - Isolation method (e.g., “chroot”, “rootless”, “oci”)
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn copy( &self, source: &str, dest: &str, ) -> Result<CommandResult, BuildahError>

Copy files into the container

§Arguments
  • source - Source path
  • dest - Destination path in the container
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn add( &self, source: &str, dest: &str, ) -> Result<CommandResult, BuildahError>

Add files into the container

§Arguments
  • source - Source path
  • dest - Destination path in the container
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn commit(&self, image_name: &str) -> Result<CommandResult, BuildahError>

Commit the container to an image

§Arguments
  • image_name - Name for the new image
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn remove(&self) -> Result<CommandResult, BuildahError>

Remove the container

§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn reset(&mut self) -> Result<(), BuildahError>

Reset the builder by removing the container and clearing the container_id

§Returns
  • Result<(), BuildahError> - Success or error
Source

pub fn config( &self, options: HashMap<String, String>, ) -> Result<CommandResult, BuildahError>

Configure container metadata

§Arguments
  • options - Map of configuration options
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn set_entrypoint( &self, entrypoint: &str, ) -> Result<CommandResult, BuildahError>

Set the entrypoint for the container

§Arguments
  • entrypoint - The entrypoint command
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn set_cmd(&self, cmd: &str) -> Result<CommandResult, BuildahError>

Set the default command for the container

§Arguments
  • cmd - The default command
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn images() -> Result<Vec<Image>, BuildahError>

List images in local storage

§Returns
  • Result<Vec<Image>, BuildahError> - List of images or error
Source

pub fn image_remove(image: &str) -> Result<CommandResult, BuildahError>

Remove an image

§Arguments
  • image - Image ID or name
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn image_remove_with_debug( image: &str, debug: bool, ) -> Result<CommandResult, BuildahError>

Remove an image with debug output

§Arguments
  • image - Image ID or name
  • debug - Whether to enable debug output
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn image_pull( image: &str, tls_verify: bool, ) -> Result<CommandResult, BuildahError>

Pull an image from a registry

§Arguments
  • image - Image name
  • tls_verify - Whether to verify TLS
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn image_pull_with_debug( image: &str, tls_verify: bool, debug: bool, ) -> Result<CommandResult, BuildahError>

Pull an image from a registry with debug output

§Arguments
  • image - Image name
  • tls_verify - Whether to verify TLS
  • debug - Whether to enable debug output
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn image_push( image: &str, destination: &str, tls_verify: bool, ) -> Result<CommandResult, BuildahError>

Push an image to a registry

§Arguments
  • image - Image name
  • destination - Destination registry
  • tls_verify - Whether to verify TLS
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn image_push_with_debug( image: &str, destination: &str, tls_verify: bool, debug: bool, ) -> Result<CommandResult, BuildahError>

Push an image to a registry with debug output

§Arguments
  • image - Image name
  • destination - Destination registry
  • tls_verify - Whether to verify TLS
  • debug - Whether to enable debug output
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn image_tag( image: &str, new_name: &str, ) -> Result<CommandResult, BuildahError>

Tag an image

§Arguments
  • image - Image ID or name
  • new_name - New tag for the image
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn image_tag_with_debug( image: &str, new_name: &str, debug: bool, ) -> Result<CommandResult, BuildahError>

Tag an image with debug output

§Arguments
  • image - Image ID or name
  • new_name - New tag for the image
  • debug - Whether to enable debug output
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn image_commit( container: &str, image_name: &str, format: Option<&str>, squash: bool, rm: bool, ) -> Result<CommandResult, BuildahError>

Commit a container to an image with advanced options

§Arguments
  • container - Container ID or name
  • image_name - Name for the new image
  • format - Optional format (oci or docker)
  • squash - Whether to squash layers
  • rm - Whether to remove the container after commit
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn image_commit_with_debug( container: &str, image_name: &str, format: Option<&str>, squash: bool, rm: bool, debug: bool, ) -> Result<CommandResult, BuildahError>

Commit a container to an image with advanced options and debug output

§Arguments
  • container - Container ID or name
  • image_name - Name for the new image
  • format - Optional format (oci or docker)
  • squash - Whether to squash layers
  • rm - Whether to remove the container after commit
  • debug - Whether to enable debug output
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn build( tag: Option<&str>, context_dir: &str, file: &str, isolation: Option<&str>, ) -> Result<CommandResult, BuildahError>

Build an image from a Containerfile/Dockerfile

§Arguments
  • tag - Optional tag for the image
  • context_dir - Directory containing the Containerfile/Dockerfile
  • file - Path to the Containerfile/Dockerfile
  • isolation - Optional isolation method
§Returns
  • Result<CommandResult, BuildahError> - Command result or error
Source

pub fn build_with_debug( tag: Option<&str>, context_dir: &str, file: &str, isolation: Option<&str>, debug: bool, ) -> Result<CommandResult, BuildahError>

Build an image from a Containerfile/Dockerfile with debug output

§Arguments
  • tag - Optional tag for the image
  • context_dir - Directory containing the Containerfile/Dockerfile
  • file - Path to the Containerfile/Dockerfile
  • isolation - Optional isolation method
  • debug - Whether to enable debug output
§Returns
  • Result<CommandResult, BuildahError> - Command result or error

Trait Implementations§

Source§

impl Clone for Builder

Source§

fn clone(&self) -> Builder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V