pub struct TagCommand {
pub executor: CommandExecutor,
/* private fields */
}
Expand description
Docker tag command builder
Create a tag TARGET_IMAGE
that refers to SOURCE_IMAGE
.
§Example
use docker_wrapper::TagCommand;
// Tag an image with a new name
TagCommand::new("myapp:latest", "myregistry.com/myapp:v1.0.0")
.run()
.await?;
// Tag with just a new tag on the same repository
TagCommand::new("myapp:latest", "myapp:stable")
.run()
.await?;
Fields§
§executor: CommandExecutor
Command executor
Implementations§
Source§impl TagCommand
impl TagCommand
Sourcepub fn new(
source_image: impl Into<String>,
target_image: impl Into<String>,
) -> Self
pub fn new( source_image: impl Into<String>, target_image: impl Into<String>, ) -> Self
Create a new tag command
§Example
use docker_wrapper::TagCommand;
// Tag an image for a registry
let cmd = TagCommand::new("myapp:latest", "docker.io/myuser/myapp:v1.0");
// Create an alias tag
let cmd = TagCommand::new("nginx:1.21", "nginx:stable");
Sourcepub async fn run(&self) -> Result<TagResult>
pub async fn run(&self) -> Result<TagResult>
Execute the tag command
§Errors
Returns an error if:
- The Docker daemon is not running
- The source image doesn’t exist
- The target image name is invalid
§Example
use docker_wrapper::TagCommand;
let result = TagCommand::new("alpine:latest", "my-alpine:latest")
.run()
.await?;
if result.success() {
println!("Image tagged successfully");
}
Sourcepub fn get_executor(&self) -> &CommandExecutor
pub fn get_executor(&self) -> &CommandExecutor
Get a reference to the command executor
Sourcepub fn get_executor_mut(&mut self) -> &mut CommandExecutor
pub fn get_executor_mut(&mut self) -> &mut CommandExecutor
Get a mutable reference to the command executor
Trait Implementations§
Source§impl Clone for TagCommand
impl Clone for TagCommand
Source§fn clone(&self) -> TagCommand
fn clone(&self) -> TagCommand
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TagCommand
impl Debug for TagCommand
Source§impl DockerCommand for TagCommand
impl DockerCommand for TagCommand
Source§type Output = CommandOutput
type Output = CommandOutput
The output type this command produces
Source§fn get_executor(&self) -> &CommandExecutor
fn get_executor(&self) -> &CommandExecutor
Get the command executor for extensibility
Source§fn get_executor_mut(&mut self) -> &mut CommandExecutor
fn get_executor_mut(&mut self) -> &mut CommandExecutor
Get mutable command executor for extensibility
Source§fn build_command_args(&self) -> Vec<String>
fn build_command_args(&self) -> Vec<String>
Build the complete command arguments including subcommands
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the command and return the typed output
Source§fn execute_command<'life0, 'async_trait>(
&'life0 self,
command_args: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn execute_command<'life0, 'async_trait>(
&'life0 self,
command_args: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<CommandOutput>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Helper method to execute the command with proper error handling
Source§fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self
fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self
Add a raw argument to the command (escape hatch)
Auto Trait Implementations§
impl Freeze for TagCommand
impl RefUnwindSafe for TagCommand
impl Send for TagCommand
impl Sync for TagCommand
impl Unpin for TagCommand
impl UnwindSafe for TagCommand
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more