pub struct DockerClient { /* private fields */ }Expand description
Thin async wrapper around a Bollard Docker client.
Implementations§
Source§impl DockerClient
impl DockerClient
Sourcepub async fn connect() -> Result<Self, DockerError>
pub async fn connect() -> Result<Self, DockerError>
Connect to Docker using Bollard defaults and verify connectivity with ping.
Sourcepub fn from_bollard(docker: Docker) -> Self
pub fn from_bollard(docker: Docker) -> Self
Wrap an existing Bollard Docker client.
Sourcepub async fn ensure_image(
&self,
image: &str,
) -> Result<ImageStatus, DockerError>
pub async fn ensure_image( &self, image: &str, ) -> Result<ImageStatus, DockerError>
Ensure a Docker image exists locally, pulling it if necessary.
Sourcepub async fn create_and_start(
&self,
spec: ContainerSpec,
) -> Result<SpawnedContainer, DockerError>
pub async fn create_and_start( &self, spec: ContainerSpec, ) -> Result<SpawnedContainer, DockerError>
Create and start a container from a ContainerSpec.
Sourcepub async fn inspect_container(
&self,
container_id: &str,
) -> Result<SpawnedContainer, DockerError>
pub async fn inspect_container( &self, container_id: &str, ) -> Result<SpawnedContainer, DockerError>
Inspect an existing container and return refreshed metadata.
Sourcepub async fn stop_container(
&self,
container_id: &str,
) -> Result<(), DockerError>
pub async fn stop_container( &self, container_id: &str, ) -> Result<(), DockerError>
Stop an existing container. Already-stopped containers are treated as success.
Sourcepub async fn start_container(
&self,
container_id: &str,
) -> Result<SpawnedContainer, DockerError>
pub async fn start_container( &self, container_id: &str, ) -> Result<SpawnedContainer, DockerError>
Start an existing container and return refreshed metadata.
Sourcepub async fn restart_container(
&self,
container_id: &str,
) -> Result<SpawnedContainer, DockerError>
pub async fn restart_container( &self, container_id: &str, ) -> Result<SpawnedContainer, DockerError>
Stop and start an existing container, returning refreshed metadata.
Sourcepub async fn create_network(
&self,
spec: NetworkSpec,
) -> Result<ManagedNetwork, DockerError>
pub async fn create_network( &self, spec: NetworkSpec, ) -> Result<ManagedNetwork, DockerError>
Create a managed Docker network and return its inspected metadata.
Sourcepub async fn remove_network(&self, network: &str) -> Result<(), DockerError>
pub async fn remove_network(&self, network: &str) -> Result<(), DockerError>
Remove a Docker network by id or name.
Sourcepub async fn copy_file_from_container(
&self,
container_id: &str,
path: &str,
) -> Result<Vec<u8>, DockerError>
pub async fn copy_file_from_container( &self, container_id: &str, path: &str, ) -> Result<Vec<u8>, DockerError>
Copy a single file from a container and return its bytes.
Sourcepub async fn cleanup_cluster(
&self,
cluster_id: &str,
) -> Result<CleanupReport, DockerError>
pub async fn cleanup_cluster( &self, cluster_id: &str, ) -> Result<CleanupReport, DockerError>
Remove all managed containers with the given cluster id.
Sourcepub async fn cleanup_all(&self) -> Result<CleanupReport, DockerError>
pub async fn cleanup_all(&self) -> Result<CleanupReport, DockerError>
Remove all containers and networks managed by this crate.
Sourcepub async fn managed_container_ids(&self) -> Result<Vec<String>, DockerError>
pub async fn managed_container_ids(&self) -> Result<Vec<String>, DockerError>
Return ids for all containers managed by this crate.
Sourcepub async fn managed_network_ids(&self) -> Result<Vec<String>, DockerError>
pub async fn managed_network_ids(&self) -> Result<Vec<String>, DockerError>
Return ids for all networks managed by this crate.
Sourcepub async fn cluster_container_ids(
&self,
cluster_id: &str,
) -> Result<Vec<String>, DockerError>
pub async fn cluster_container_ids( &self, cluster_id: &str, ) -> Result<Vec<String>, DockerError>
Return ids for all managed containers with the given cluster id.
Sourcepub async fn cluster_network_ids(
&self,
cluster_id: &str,
) -> Result<Vec<String>, DockerError>
pub async fn cluster_network_ids( &self, cluster_id: &str, ) -> Result<Vec<String>, DockerError>
Return ids for all managed networks with the given cluster id.
Sourcepub async fn container_logs(
&self,
container_id: &str,
) -> Result<String, DockerError>
pub async fn container_logs( &self, container_id: &str, ) -> Result<String, DockerError>
Return recent stdout/stderr logs from a container.
Sourcepub fn rollback_guard(&self) -> StartupRollback<'_>
pub fn rollback_guard(&self) -> StartupRollback<'_>
Create a rollback guard for containers created during startup.
Sourcepub async fn rollback_containers<I>(
&self,
container_ids: I,
) -> Result<CleanupReport, DockerError>
pub async fn rollback_containers<I>( &self, container_ids: I, ) -> Result<CleanupReport, DockerError>
Stop and remove explicit container ids.
Trait Implementations§
Source§impl Clone for DockerClient
impl Clone for DockerClient
Source§fn clone(&self) -> DockerClient
fn clone(&self) -> DockerClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DockerClient
impl !RefUnwindSafe for DockerClient
impl Send for DockerClient
impl Sync for DockerClient
impl Unpin for DockerClient
impl UnsafeUnpin for DockerClient
impl !UnwindSafe for DockerClient
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request