use lmrc_docker::{DockerClient, Result};
#[tokio::main]
async fn main() -> Result<()> {
let client = DockerClient::new()?;
println!("=== Containers ===");
let containers = client.containers().list(true).await?;
for container in containers {
let id = container.id.unwrap_or_default();
let id_short = if id.len() >= 12 { &id[..12] } else { &id };
let state = container
.state
.map(|s| format!("{:?}", s))
.unwrap_or_else(|| "unknown".to_string());
println!(" {} - {:?} ({})", id_short, container.names, state);
}
println!("\n=== Images ===");
let images = client.images().list(false).await?;
for image in images {
println!(" {} - {:?}", &image.id[..12], image.repo_tags);
}
println!("\n=== Networks ===");
let networks = client.networks().list().await?;
for network in networks {
let id = network.id.unwrap_or_default();
let id_short = if id.len() >= 12 { &id[..12] } else { &id };
println!(" {} - {}", id_short, network.name.unwrap_or_default());
}
println!("\n=== Volumes ===");
let volumes = client.volumes().list().await?;
for volume in volumes {
println!(" {}", volume.name);
}
Ok(())
}