pub struct PullCommand {
pub executor: CommandExecutor,
/* private fields */
}
Expand description
Docker Pull Command Builder
Implements the docker pull
command for downloading images from registries.
§Docker Pull Overview
The pull command downloads images from Docker registries (like Docker Hub) to the local Docker daemon. It supports:
- Single image pull by name and tag
- All tags pull for a repository
- Multi-platform image selection
- Quiet mode for minimal output
- Content trust verification control
§Image Naming
Images can be specified in several formats:
image
- Defaults to latest tagimage:tag
- Specific tagimage@digest
- Specific digestregistry/image:tag
- Specific registryregistry:port/image:tag
- Custom registry port
§Examples
use docker_wrapper::PullCommand;
use docker_wrapper::DockerCommand;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Pull latest nginx
let output = PullCommand::new("nginx")
.execute()
.await?;
println!("Pull success: {}", output.success);
Ok(())
}
Fields§
§executor: CommandExecutor
Command executor for handling raw arguments and execution
Implementations§
Source§impl PullCommand
impl PullCommand
Download all tagged images in the repository
When enabled, pulls all available tags for the specified image repository. Cannot be used with specific tags or digests.
§Examples
use docker_wrapper::PullCommand;
let pull_cmd = PullCommand::new("alpine")
.all_tags();
Sourcepub fn disable_content_trust(self) -> Self
pub fn disable_content_trust(self) -> Self
Skip image verification (disable content trust)
By default, Docker may verify image signatures when content trust is enabled. This option disables that verification.
§Examples
use docker_wrapper::PullCommand;
let pull_cmd = PullCommand::new("nginx:latest")
.disable_content_trust();
Sourcepub fn platform<S: Into<String>>(self, platform: S) -> Self
pub fn platform<S: Into<String>>(self, platform: S) -> Self
Set platform if server is multi-platform capable
Specifies the platform for which to pull the image when the image supports multiple platforms (architectures).
Common platform values:
linux/amd64
- 64-bit Intel/AMD Linuxlinux/arm64
- 64-bit ARM Linuxlinux/arm/v7
- 32-bit ARM Linuxwindows/amd64
- 64-bit Windows
§Examples
use docker_wrapper::PullCommand;
let pull_cmd = PullCommand::new("nginx:latest")
.platform("linux/arm64");
Sourcepub fn quiet(self) -> Self
pub fn quiet(self) -> Self
Suppress verbose output
Reduces the amount of output during the pull operation.
§Examples
use docker_wrapper::PullCommand;
let pull_cmd = PullCommand::new("nginx:latest")
.quiet();
Sourcepub fn get_image(&self) -> &str
pub fn get_image(&self) -> &str
Get the image name
§Examples
use docker_wrapper::PullCommand;
let pull_cmd = PullCommand::new("nginx:latest");
assert_eq!(pull_cmd.get_image(), "nginx:latest");
Check if all tags mode is enabled
§Examples
use docker_wrapper::PullCommand;
let pull_cmd = PullCommand::new("alpine").all_tags();
assert!(pull_cmd.is_all_tags());
Sourcepub fn is_quiet(&self) -> bool
pub fn is_quiet(&self) -> bool
Check if quiet mode is enabled
§Examples
use docker_wrapper::PullCommand;
let pull_cmd = PullCommand::new("nginx").quiet();
assert!(pull_cmd.is_quiet());
Sourcepub fn get_platform(&self) -> Option<&str>
pub fn get_platform(&self) -> Option<&str>
Get the platform if set
§Examples
use docker_wrapper::PullCommand;
let pull_cmd = PullCommand::new("nginx").platform("linux/arm64");
assert_eq!(pull_cmd.get_platform(), Some("linux/arm64"));
Sourcepub fn is_content_trust_disabled(&self) -> bool
pub fn is_content_trust_disabled(&self) -> bool
Check if content trust is disabled
§Examples
use docker_wrapper::PullCommand;
let pull_cmd = PullCommand::new("nginx").disable_content_trust();
assert!(pull_cmd.is_content_trust_disabled());
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 PullCommand
impl Clone for PullCommand
Source§fn clone(&self) -> PullCommand
fn clone(&self) -> PullCommand
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more