lmrc_docker/lib.rs
1#![allow(deprecated)]
2#![allow(unused_imports)]
3//! # Docker Client
4//!
5//! A comprehensive, ergonomic Docker client library for Rust built on top of Bollard.
6//!
7//! ## Features
8//!
9//! - **Full Docker API Coverage**: Containers, images, networks, and volumes
10//! - **Fluent Builder APIs**: Ergonomic, chainable methods for creating resources
11//! - **Async/Await**: Built on Tokio for modern async Rust
12//! - **Type-Safe**: Leverage Rust's type system for compile-time safety
13//! - **Well Documented**: Comprehensive documentation and examples
14//!
15//! ## Quick Start
16//!
17//! ```no_run
18//! use lmrc_docker::DockerClient;
19//!
20//! #[tokio::main]
21//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
22//! // Create a client
23//! let client = DockerClient::new()?;
24//!
25//! // Check Docker is available
26//! client.ping().await?;
27//!
28//! // Pull an image
29//! client.images().pull("nginx:latest", None).await?;
30//!
31//! // Create and start a container
32//! let container = client.containers()
33//! .create("nginx:latest")
34//! .name("web-server")
35//! .port(8080, 80, "tcp")
36//! .env("ENV", "production")
37//! .build()
38//! .await?;
39//!
40//! container.start().await?;
41//!
42//! // List running containers
43//! let containers = client.containers().list(false).await?;
44//! println!("Running {} containers", containers.len());
45//!
46//! // Stop and remove the container
47//! container.stop(Some(10)).await?;
48//! container.remove(false, false).await?;
49//!
50//! Ok(())
51//! }
52//! ```
53//!
54//! ## Modules
55//!
56//! - [`client`]: Docker client configuration and connection
57//! - [`containers`]: Container lifecycle management
58//! - [`images`]: Image operations (build, pull, push, etc.)
59//! - [`networks`]: Network management
60//! - [`volumes`]: Volume operations
61//! - [`registry`]: Registry operations (search, authentication, image management)
62//! - [`error`]: Error types and result aliases
63
64// Re-export commonly used types from bollard
65pub use bollard::auth::DockerCredentials;
66pub use bollard::models::{
67 ContainerInspectResponse, ContainerSummary, ImageInspect, ImageSummary, Network, Volume,
68};
69
70// Public modules
71pub mod client;
72pub mod containers;
73pub mod error;
74pub mod images;
75pub mod networks;
76pub mod registry;
77pub mod volumes;
78
79// Re-export main types at crate root for convenience
80pub use client::{DockerClient, DockerClientConfig};
81pub use containers::{ContainerBuilder, ContainerRef, Containers};
82pub use error::{DockerError, Result};
83pub use images::{ImageBuilder, ImageRef, Images};
84pub use networks::{NetworkRef, Networks};
85pub use registry::{ImageSearchResult, Registry, RegistryConfig};
86pub use volumes::{VolumeRef, Volumes};