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 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 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 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 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
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 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
Mutably borrows from an owned value. Read more
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>
Wrap the input message
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>
Wrap the input message
T in a tonic::Request