Skip to main content

ironflow_ops_docker/
lib.rs

1//! Docker operations for Ironflow workflows, powered by [`bollard`].
2//!
3//! This crate provides Docker operations as Ironflow
4//! [`Operation`](ironflow_core::operation::Operation) implementations. Each
5//! operation wraps a [`bollard`] API call.
6//!
7//! # Architecture
8//!
9//! - [`DockerClient`] is the central handle, wrapping a [`bollard::Docker`] connection
10//! - Each operation is a standalone struct implementing [`Operation`](ironflow_core::operation::Operation)
11//! - All operations return `kind() == "docker"`
12//! - Parameters are set at construction time via builder methods
13//!
14//! # Quick start
15//!
16//! ```no_run
17//! use ironflow_ops_docker::DockerClient;
18//! use ironflow_ops_docker::containers::{ContainerCreate, ContainerStart, ContainerRemove};
19//! use ironflow_ops_docker::system::SystemPing;
20//! use ironflow_core::operation::{Operation, OperationContext, NoopSecretResolver};
21//! use std::sync::Arc;
22//!
23//! # async fn example() -> Result<(), ironflow_core::error::OperationError> {
24//! let ctx = OperationContext::new(Arc::new(NoopSecretResolver));
25//! let client = DockerClient::connect_local()?;
26//!
27//! // Ping the daemon
28//! let ping = SystemPing::new(&client);
29//! ping.execute(&ctx).await?;
30//!
31//! // Create and start a container
32//! let create = ContainerCreate::new(&client, "my-app", "alpine:latest")
33//!     .cmd(vec!["sleep".into(), "3600".into()]);
34//! let output = create.run(&ctx).await?;
35//!
36//! let start = ContainerStart::new(&client, &output.id);
37//! start.run(&ctx).await?;
38//!
39//! // Cleanup
40//! let remove = ContainerRemove::new(&client, &output.id).force();
41//! remove.run(&ctx).await?;
42//! # Ok(())
43//! # }
44//! ```
45//!
46//! # Modules
47//!
48//! Operations are organized by Docker domain:
49//!
50//! | Module | Operations |
51//! |--------|-----------|
52//! | [`containers`] | Create, Start, Stop, Restart, Kill, Remove, Inspect, List, Logs, Exec, Wait, Pause, Unpause, Rename, Top, Stats, Changes, Prune |
53//! | [`images`] | List, Pull, Push, Inspect, Remove, Tag, History, Search, Prune |
54//! | [`volumes`] | Create, Inspect, List, Remove, Prune |
55//! | [`networks`] | Create, Inspect, List, Remove, Connect, Disconnect, Prune |
56//! | [`system`] | Info, Version, Ping, Df |
57
58mod client;
59pub mod containers;
60mod helpers;
61pub mod images;
62pub mod networks;
63pub mod system;
64pub mod volumes;
65
66pub use bollard;
67pub use client::DockerClient;