From f07faddbd97ec22754b3bf008f3676e552cbca3e Mon Sep 17 00:00:00 2001 From: Mads Jon Nielsen Date: Mon, 31 Aug 2026 07:56:10 +0200 Subject: [PATCH 1/2] Don't inspect containers with the dead status --- src/run.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/run.rs b/src/run.rs index b01fe44..a3609b1 100644 --- a/src/run.rs +++ b/src/run.rs @@ -26,15 +26,16 @@ use sysinfo::{Disk, Disks}; // maximum number of container IDs to query at once. const CONTAINER_IDS_CHUNK_SIZE: usize = 100; -// The `docker container inspect` command seems to fail on containers with this status. Source: +// The `docker container inspect` command seems to fail on containers with these statuses. Source: // https://github.com/stepchowfun/docuum/issues/237 const CONTAINER_STATUS_REMOVING: &str = "removing"; +const CONTAINER_STATUS_DEAD: &str = "dead"; // These are all the possible statuses returned from `docker container ls`. Source: // https://docs.docker.com/reference/cli/docker/container/ls/#status const CONTAINER_STATUSES: [&str; 7] = [ "created", - "dead", + CONTAINER_STATUS_DEAD, "exited", "paused", "restarting", @@ -253,7 +254,9 @@ fn image_ids_in_use() -> io::Result> { .chain( CONTAINER_STATUSES .iter() - .filter(|&&status| status != CONTAINER_STATUS_REMOVING) + .filter(|&&status| { + status != CONTAINER_STATUS_REMOVING && status != CONTAINER_STATUS_DEAD + }) .flat_map(|&status| [String::from("--filter"), format!("status={status}")]), ) .chain( From c3a75d92af5cf7442a5129c846c0e9e57e32e75e Mon Sep 17 00:00:00 2001 From: Mads Jon Nielsen Date: Tue, 1 Sep 2026 09:28:58 +0200 Subject: [PATCH 2/2] Collect uninspectable container statuses in one array --- src/run.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/run.rs b/src/run.rs index a3609b1..a479653 100644 --- a/src/run.rs +++ b/src/run.rs @@ -28,19 +28,18 @@ const CONTAINER_IDS_CHUNK_SIZE: usize = 100; // The `docker container inspect` command seems to fail on containers with these statuses. Source: // https://github.com/stepchowfun/docuum/issues/237 -const CONTAINER_STATUS_REMOVING: &str = "removing"; -const CONTAINER_STATUS_DEAD: &str = "dead"; +const UNINSPECTABLE_CONTAINER_STATUSES: [&str; 2] = ["dead", "removing"]; // These are all the possible statuses returned from `docker container ls`. Source: // https://docs.docker.com/reference/cli/docker/container/ls/#status const CONTAINER_STATUSES: [&str; 7] = [ "created", - CONTAINER_STATUS_DEAD, + "dead", "exited", "paused", "restarting", "running", - CONTAINER_STATUS_REMOVING, + "removing", ]; // A Docker event (a line of output from `docker system events --format '{{json .}}'`) @@ -254,9 +253,7 @@ fn image_ids_in_use() -> io::Result> { .chain( CONTAINER_STATUSES .iter() - .filter(|&&status| { - status != CONTAINER_STATUS_REMOVING && status != CONTAINER_STATUS_DEAD - }) + .filter(|&&status| !UNINSPECTABLE_CONTAINER_STATUSES.contains(&status)) .flat_map(|&status| [String::from("--filter"), format!("status={status}")]), ) .chain(