MCPcopy Create free account
hub / github.com/codename-co/stack / list_containers

Function list_containers

packages/app/src-tauri/src/docker.rs:71–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69
70#[command]
71pub async fn list_containers() -> Result<Vec<ContainerSummary>, String> {
72 println!("list_containers");
73 let docker = get_docker().await?;
74 let mut containers = get_containers(&docker).await?;
75 // Sort labels for each container
76 for container in &mut containers {
77 if let Some(labels) = &mut container.labels {
78 let sorted_labels = labels.clone();
79 let mut keys: Vec<_> = sorted_labels.keys().cloned().collect();
80 keys.sort();
81 let sorted: std::collections::BTreeMap<_, _> = keys
82 .into_iter()
83 .map(|k| (k.clone(), sorted_labels.get(&k).unwrap().clone()))
84 .collect();
85 *labels = sorted.into_iter().collect();
86 }
87 }
88 Ok(containers)
89}
90
91#[command]
92pub async fn list_networks() -> Result<Vec<Network>, String> {

Callers

nothing calls this directly

Calls 2

get_dockerFunction · 0.85
get_containersFunction · 0.85

Tested by

no test coverage detected