Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.25.1] - 2025-10-19

### Fixed
- Docuum no longer enters a crash loop when there are containers stuck in the `removing` state. Thanks to Addison Kimball for reporting this issue, and thanks to Farrukh Taqveem for investigating and fixing it.

## [0.25.0] - 2024-05-02

### Added
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "docuum"
version = "0.25.0"
version = "0.25.1"
authors = ["Stephan Boyer <stephan@stephanboyer.com>"]
edition = "2024"
description = "LRU eviction of Docker images."
Expand Down
53 changes: 33 additions & 20 deletions src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,22 @@ use {
// maximum number of container IDs to query at once.
const CONTAINER_IDS_CHUNK_SIZE: usize = 100;

// [tag:container_status_removing] The `docker container inspect` command seems to fail on
// containers with this status. Source: https://github.com/stepchowfun/docuum/issues/237
const CONTAINER_STATUS_REMOVING: &str = "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",
"dead",
"exited",
"paused",
"restarting",
"running",
CONTAINER_STATUS_REMOVING,
];

// A Docker event (a line of output from `docker events --format '{{json .}}'`)
#[derive(Deserialize, Serialize, Debug)]
struct Event {
Expand Down Expand Up @@ -218,26 +234,23 @@ fn list_image_records(state: &State) -> io::Result<HashMap<String, ImageRecord>>
fn image_ids_in_use() -> io::Result<HashSet<String>> {
// Query Docker for all the container IDs.
let container_ids_output = Command::new("docker")
.args([
"container",
"ls",
"--all",
"--filter",
"status=created",
"--filter",
"status=restarting",
"--filter",
"status=running",
"--filter",
"status=paused",
"--filter",
"status=exited",
"--filter",
"status=dead",
"--no-trunc",
"--format",
"{{.ID}}",
])
.args(
["container", "ls", "--all"]
.into_iter()
.map(std::string::ToString::to_string)
.chain(
CONTAINER_STATUSES
.iter()
.filter(|&&status| status != CONTAINER_STATUS_REMOVING)
.flat_map(|&status| [String::from("--filter"), format!("status={status}")]),
)
.chain(
["--no-trunc", "--format", "{{.ID}}"]
.into_iter()
.map(std::string::ToString::to_string),
)
.collect::<Vec<String>>(),
)
.stderr(Stdio::inherit())
.output()?;

Expand Down