pub struct DockerCliRunner { /* private fields */ }Expand description
Docker CLI runner bound to a Unix socket.
Implementations§
Source§impl DockerCliRunner
impl DockerCliRunner
Sourcepub fn new(socket_path: impl Into<PathBuf>) -> Result<Self>
pub fn new(socket_path: impl Into<PathBuf>) -> Result<Self>
Creates a new CLI runner for the provided Docker socket.
§Errors
Returns an error if the docker binary cannot be located.
Sourcepub fn socket_path(&self) -> &Path
pub fn socket_path(&self) -> &Path
Returns the socket path used by this runner.
Sourcepub const fn helper_image_reference(&self) -> &'static str
pub const fn helper_image_reference(&self) -> &'static str
Returns the helper image reference used for temporary volume containers.
Sourcepub async fn info(&self) -> Result<DockerInfo>
pub async fn info(&self) -> Result<DockerInfo>
Returns Docker daemon info.
Sourcepub async fn list_images(&self) -> Result<Vec<ImageInspect>>
pub async fn list_images(&self) -> Result<Vec<ImageInspect>>
Returns all image inspect payloads.
Sourcepub async fn list_volumes(&self) -> Result<Vec<VolumeInspect>>
pub async fn list_volumes(&self) -> Result<Vec<VolumeInspect>>
Returns all volume inspect payloads.
Sourcepub async fn list_networks(&self) -> Result<Vec<NetworkInspect>>
pub async fn list_networks(&self) -> Result<Vec<NetworkInspect>>
Returns all user-defined network inspect payloads.
Sourcepub async fn list_containers(&self) -> Result<Vec<ContainerInspect>>
pub async fn list_containers(&self) -> Result<Vec<ContainerInspect>>
Returns all container inspect payloads, including stopped containers.
Sourcepub async fn stop_container(&self, id: &str) -> Result<()>
pub async fn stop_container(&self, id: &str) -> Result<()>
Stops a container.
Sourcepub async fn remove_container(&self, id: &str) -> Result<()>
pub async fn remove_container(&self, id: &str) -> Result<()>
Removes a container forcibly.
Sourcepub async fn remove_volume(&self, name: &str) -> Result<()>
pub async fn remove_volume(&self, name: &str) -> Result<()>
Removes a volume.
Sourcepub async fn remove_network(&self, name: &str) -> Result<()>
pub async fn remove_network(&self, name: &str) -> Result<()>
Removes a network.
Sourcepub async fn create_volume(
&self,
name: &str,
labels: &[(String, String)],
options: &[(String, String)],
) -> Result<()>
pub async fn create_volume( &self, name: &str, labels: &[(String, String)], options: &[(String, String)], ) -> Result<()>
Creates a volume with labels and options.
Sourcepub async fn create_network(
&self,
name: &str,
config: &CreateNetworkOptions,
) -> Result<()>
pub async fn create_network( &self, name: &str, config: &CreateNetworkOptions, ) -> Result<()>
Creates a network using supported bridge-network flags.
Sourcepub async fn create_container<I, S>(&self, args: I) -> Result<String>
pub async fn create_container<I, S>(&self, args: I) -> Result<String>
Creates a container and returns its ID.
Sourcepub async fn connect_network(
&self,
network: &str,
container: &str,
aliases: &[String],
) -> Result<()>
pub async fn connect_network( &self, network: &str, container: &str, aliases: &[String], ) -> Result<()>
Connects a container to an additional network.
Sourcepub async fn create_helper_container(
&self,
name: &str,
volume_name: &str,
) -> Result<String>
pub async fn create_helper_container( &self, name: &str, volume_name: &str, ) -> Result<String>
Creates a helper container mounting the provided volume at /volume.
Sourcepub async fn ensure_helper_image(&self) -> Result<()>
pub async fn ensure_helper_image(&self) -> Result<()>
Ensures the helper image exists by importing an empty tar archive when needed.
Sourcepub async fn save_image(&self, reference: &str) -> Result<NamedTempFile>
pub async fn save_image(&self, reference: &str) -> Result<NamedTempFile>
Saves an image to a tempfile.
Sourcepub async fn load_image(&self, path: &Path) -> Result<()>
pub async fn load_image(&self, path: &Path) -> Result<()>
Loads an image from a tempfile.
Sourcepub async fn copy_from_container(
&self,
container: &str,
source_path: &str,
) -> Result<NamedTempFile>
pub async fn copy_from_container( &self, container: &str, source_path: &str, ) -> Result<NamedTempFile>
Streams a container path into a tempfile via docker cp.
Trait Implementations§
Source§impl Clone for DockerCliRunner
impl Clone for DockerCliRunner
Source§fn clone(&self) -> DockerCliRunner
fn clone(&self) -> DockerCliRunner
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more