DockerSelf-Hosting

Docuum with Docker: Delete Old Docker Images Before the Disk Fills (Linux, Windows, Mac)

Before you start

  • 17 min read

Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#

Docuum is a free, open-source program that watches which Docker images you actually use and, when all your images together get bigger than a limit you set, deletes the least recently used ones first. It never touches volumes, running containers or the build cache.

Docuum title card (no official logo)

Image: DIY Lab Hub title card. Docuum has no official logo.

Docker keeps every image you pulled until you remove it, and does not record when an image was last used. Docuum fills that gap: it listens to Docker's events, remembers each image's last use, and trims from the oldest use upwards. That suits a homelab or build server where images pile up. It is not a general "disk full" fixer: it removes images only.

WhatValue (official sources, read 3 December 2026)
Current versionDocuum 0.27.4, GitHub release of 1 December 2026 (the changelog dates it 30 November). crates.io lists the same version
Image to pinstephanmisc/docuum:0.27.4 (tag checked on Docker Hub; amd64 and arm64; about 16 MB compressed)
Time neededAbout 20 minutes (our estimate)
PortsNone, no web page
LicenceMIT (LICENSE.md at the release tag)
NeedsDocker Engine 17.03.0 or later (README)
Official docsgithub.com/stepchowfun/docuum (the README is the documentation)

At a glance:

  • What it deletes: images only, oldest last use first. Images used by any container, running or stopped, are skipped.
  • What sets the limit: --threshold, for example 20 GB, or 50% on Linux.
  • What it protects: images whose repository:tag matches a --keep regular expression.
  • How it runs: as a small container (our choice) or as a program under systemd, launchd or NSSM.
  • What it cannot do: preview. It has no dry-run mode, so read Step 1 first.

How it fits together#

Docuum asks Docker to tell it about every container and image event, writes down the last use of each image in a small state file, and deletes the oldest unused images through the Docker socket whenever the image total is over your limit.

Docuum flow: containers use images in the Docker Engine, which sends events to Docuum; Docuum saves each last use in state.yml, and when the total is over the limit deletes the oldest unused image, skipping --keep matches, until it is under the limit

Drawn for this guide from the official README and source code.

Four facts from the source at tag v0.27.4 explain most surprises:

  • At start it checks at once, before any event, and deletes down to the limit.
  • An image it has never seen gets its creation date as "last used" at first start; later new images get the time they appeared.
  • It measures the Images row of docker system df.
  • It deletes with docker image rm --force --no-prune and skips images any container uses.

Docuum, docker image prune and docker system prune#

Docker's own commands pick by age or by use right now. Docuum picks by last use and only when you are over a size limit.

ToolWhat it removesHow it decidesRuns
docker image pruneDangling images (untagged leftovers)Has no tag and no containerWhen you type it
docker image prune -aEvery image no container usesNot used by a container right nowWhen you type it
docker image prune -a --filter "until=240h"The same, only if created more than 10 days agoCreation date, not last useWhen you type it
docker system prune -aStopped containers, unused networks, unused images and build cache. Volumes only with --volumesNot in use right nowWhen you type it
DocuumImages onlyLeast recently used first, until under the limitAll the time, on Docker events

The README's reason: the until filter uses creation time, so it "can delete frequently used images, which may be expensive to rebuild or time-consuming to pull". An image built in March and used daily looks old to until and recent to Docuum.

Two more points. A cron job with docker system prune -a removes every unused image whatever its last use and undoes what Docuum keeps: use one approach. The build cache is separate and Docuum does not clean it (README): run docker builder prune for that, perhaps scheduled with our Ofelia guide. The old Spotify docker-gc is archived and points to docker system prune, so we skip it.

Before you start#

Note: every domain, organisation name and size on this page is a dummy example (like registry.example.com or 20 GB). Replace it with your own.

SystemWhat to have
LinuxDocker Engine and the Compose plugin
WindowsWindows 10 or later, Docker Desktop (WSL 2 backend, Linux containers), PowerShell
MacDocker Desktop, Intel or Apple Silicon
Run in terminalbash
docker --version
docker compose version

Checklist:

  • [ ] Both commands print a version
  • [ ] You know which images exist only on this machine (Docuum cannot tell)
  • [ ] You chose one cleanup method, not Docuum plus a system prune -a job

Tested by DIY Lab Hub: not yet. Commands come from the README, the repository files at tag v0.27.4 and the source, read on 3 December 2026. We did not run them on a real machine and show only output lines that appear in the source.

Tip: Docuum has no dry-run mode (issue 242 is still open). A limit below your current use deletes images at the first start. Steps 1 and 2 avoid that.

Step 1: Look at your images and pick a limit#

Docuum counts the Images row of docker system df. Look at it first, and at your image names, which you need for --keep.

Linux#

Run in terminalbash
docker system df
docker image ls --all --format '{{.Repository}}:{{.Tag}}'

Windows (PowerShell)#

Run in terminalpowershell
docker system df
docker image ls --all --format '{{.Repository}}:{{.Tag}}'

Mac (Terminal)#

Same commands as Linux.

SIZE on the Images row is the number Docuum compares with your limit. The second command prints one repository:tag per line, the exact text a --keep expression is matched against (we read this in the source).

Pick the limit. For the first run use a value larger than SIZE, so nothing is deleted, then lower it in steps. Never go below what your running containers need: Docuum cannot delete images in use, so it would delete everything else, on every new image.

Check it worked. You know your Images SIZE, and you have a list of images that must never be deleted.

Tip: Images that exist only on this machine (built locally, never pushed) are gone for good once deleted. Add them to --keep in Step 3.

Step 2: Try it once in the foreground#

A throwaway container with a limit so large that nothing can be deleted. It proves Docuum reaches Docker. The command is the project's own, with a pinned tag, debug logging and no --tty (the README says to omit it for a daemon).

Linux#

Run in terminalbash
docker container run --init --rm --name docuum-trial \
  -e LOG_LEVEL=debug \
  --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
  stephanmisc/docuum:0.27.4 --threshold '500 GB'

Windows (PowerShell)#

The README uses a double slash for the socket on Windows with Linux containers.

Run in terminalpowershell
docker container run `
  --init `
  --rm `
  --name docuum-trial `
  -e LOG_LEVEL=debug `
  --mount type=bind,src=//var/run/docker.sock,dst=/var/run/docker.sock `
  stephanmisc/docuum:0.27.4 --threshold '500 GB'

Mac (Terminal)#

Same command as Linux.

We did not run this, so we show no real output. The source prints Performing an initial vacuum on startup…, Docker images are using <size>, which is within the limit of <limit>. (debug level) and Listening for Docker events….

Check it worked. You see those three messages and no ERROR line. End it with Ctrl+C (or docker stop docuum-trial in a second window); --rm removes the container.

Tip: The program logs to the error stream. To save the log of a hand-started copy use docuum &> file.log (issue 227).

Step 3: Run it for good with Compose#

Everything lives under ~/docker_volumes/docuum. The folder data is mounted as /root, where Docuum keeps .local/share/docuum/state.yml; without it the history is lost when the container is recreated. The last three commands start it and show the log.

Linux#

Run in terminalbash
mkdir -p ~/docker_volumes/docuum/{data,config,logs,backups}
cd ~/docker_volumes/docuum
cat > compose.yaml << 'EOF'
services:
  docuum:
    image: stephanmisc/docuum:0.27.4
    container_name: docuum
    init: true
    restart: unless-stopped
    command:
      - --threshold
      - "20 GB"
      - --min-age
      - "1 hour"
      - --keep
      - '^registry\.example\.com/'
    environment:
      - LOG_LEVEL=info
    volumes:
      - ./data:/root
      - /var/run/docker.sock:/var/run/docker.sock
EOF
docker compose up -d
docker compose ps
docker compose logs --tail=50 docuum

Windows (PowerShell)#

Codepowershell
$base = "$HOME\docker_volumes\docuum"
foreach ($d in "data","config","logs","backups") {
  New-Item -ItemType Directory -Force "$base\$d" | Out-Null
}
Set-Location $base
@'
services:
  docuum:
    image: stephanmisc/docuum:0.27.4
    container_name: docuum
    init: true
    restart: unless-stopped
    command:
      - --threshold
      - "20 GB"
      - --min-age
      - "1 hour"
      - --keep
      - '^registry\.example\.com/'
    environment:
      - LOG_LEVEL=info
    volumes:
      - ./data:/root
      - /var/run/docker.sock:/var/run/docker.sock
'@ | Set-Content -Encoding ascii compose.yaml
docker compose up -d
docker compose ps
docker compose logs --tail=50 docuum

Mac (Terminal)#

Same commands as Linux.

What each line does:

LineWhy
image: ...:0.27.4A pinned tag. The README example has no tag, which means latest
init: trueThe Dockerfile says Docuum must not be the first process (--init in the README)
command: as a listEvery value is one entry, so the space in 20 GB needs no quotes
--threshold "20 GB"A dummy: use the limit from Step 1. 50% works on Linux only
--min-age "1 hour"A safety net of ours: images used in the last hour are never deleted. Format 4d or 2h 30m; months and years are rejected
--keep '^registry\.example\.com/'A dummy regular expression: never delete images whose repository:tag starts with registry.example.com/. Repeat --keep for more
LOG_LEVEL=infoThe default is debug, which is noisy
./data:/rootKeeps state.yml across updates (the official command uses a Docker volume for it)
/var/run/docker.sockRoot-level control of Docker (see Security)

Check it worked. docker compose ps shows docuum running, not restarting. The log has Listening for Docker events…. If you are over the limit it also shows Docker images are currently using <size>, but the limit is <limit>., Deleting image sha256:… lines and Docker images are now using <size>, which is within the limit of <limit>.

Docker Desktop (Windows and Mac): we did not run this there. Docuum then manages the images inside Docker Desktop's Linux virtual machine, and we did not check how that machine returns freed space to your disk.

Tip: Lower the limit in small steps and watch one cycle in the log. Each change needs docker compose up -d in this folder.

Step 4 (optional): Run the program as a service instead#

If you prefer no container, install the program and let your system run it. Run only one of the two: two copies fight each other (issue 227).

Linux#

We download the project's installer, read it, then run it with a pinned version. It puts the binary in /usr/local/bin.

Run in terminalbash
curl -LSfs -o /tmp/docuum-install.sh https://raw.githubusercontent.com/stepchowfun/docuum/v0.27.4/install.sh
less /tmp/docuum-install.sh
VERSION=0.27.4 sh /tmp/docuum-install.sh
docuum --version

On an old Linux, take the docuum-x86_64-unknown-linux-musl file from the release page instead (issue 309). Save the project's systemd sample as /etc/systemd/system/docuum.service (we only changed the dummy limit):

File contentini
[Unit]
Description=Docuum
After=docker.service
Wants=docker.service

[Service]
Environment='THRESHOLD=20 GB'
ExecStart=/usr/local/bin/docuum --threshold ${THRESHOLD}
Restart=on-failure

[Install]
WantedBy=multi-user.target
Run in terminalbash
sudo systemctl daemon-reload
sudo systemctl enable docuum --now
sudo journalctl --follow --unit docuum

Windows (PowerShell)#

The README offers a plain executable plus the NSSM service manager; there is no PowerShell installer. Run PowerShell as Administrator.

Codepowershell
New-Item -ItemType Directory -Force "C:\Program Files\Docuum" | Out-Null
Invoke-WebRequest -Uri "https://github.com/stepchowfun/docuum/releases/download/v0.27.4/docuum-x86_64-pc-windows-msvc.exe" -OutFile "C:\Program Files\Docuum\docuum.exe"
& "C:\Program Files\Docuum\docuum.exe" --version

On Windows on ARM take docuum-aarch64-pc-windows-msvc.exe. Download NSSM, put it on your PATH, run nssm install Docuum, choose the path of docuum.exe, add the arguments --threshold "20 GB" (no percentages on Windows), optionally set a log file on the I/O tab, and click Install service:

Run in terminalpowershell
nssm start Docuum

We did not test NSSM with Docker Desktop. If it cannot reach Docker, use Step 3.

Mac (Terminal)#

Install with the same four commands as Linux (curl, less, VERSION=0.27.4 sh, docuum --version).

Homebrew users can run brew install docuum instead. For a daemon, copy local.docuum.plist from the repository to /Library/LaunchDaemons/, edit the --threshold value, make it owned by root, then start it:

Run in terminalbash
sudo chown root:wheel /Library/LaunchDaemons/local.docuum.plist
sudo launchctl load /Library/LaunchDaemons/local.docuum.plist
tail -F /var/log/docuum.log

Check it worked. The version command prints 0.27.4. The service log (journal, NSSM log file or /var/log/docuum.log) shows Listening for Docker events….

Tip: A service starts with a short PATH. The sample plist lists /bin:/usr/bin:/usr/local/bin. If docker lives somewhere else (a Homebrew folder), add it, or you get the error in issue 243.

Put it behind HTTPS with Traefik? You do not need to#

Docuum has no web page and opens no port, so there is nothing to put behind HTTPS, at home or with a domain. It only talks to the Docker socket on its own machine.

With Traefik#

No labels or routes are needed. Our Traefik guide is for the apps that do have a page.

Without Traefik: Caddy#

No reverse_proxy line is needed either. For browser tools with HTTPS, see our Caddy guide.

Security and testing#

The Docker socket is the biggest risk here. Docuum must delete images, so it needs write access, and the socket gives root-level control of the host.

ControlHow
Docker socketAnything that can use it can start a container that mounts the host's disk. :ro on the mount does not limit the commands sent through it
Socket proxyOur docker-socket-proxy guide shows a filtered socket. Docuum must delete images, which that proxy allows only with POST on, and it also reads containers, events and system df. We did not test it, so we give no recipe
Image and networkPin the tag and update on purpose. No port, no inbound traffic
Deleted imagesImages that exist only on this machine cannot be restored: protect them with --keep
Data folderdata holds state.yml with image IDs: keep it private

Quick tests:

Run in terminalbash
cd ~/docker_volumes/docuum
docker compose ps
docker compose logs --tail=100 docuum
docker system df

Our Dockcheck and Diun guides tell you about updates; Docuum removes the old images later. Our dive guide shows what fills one image.

Common mistakes#

MistakeWhy it happensDo this instead
Setting a limit below today's usage, then being surprised by deletionsDocuum cleans at its first start, and has no dry-run (issue 242)Start above docker system df, then lower the limit in steps (Step 1)
Expecting it to fix "disk full" from /var/lib/docker/overlay2 (issue 271)The maintainer: "Docuum only cleans up images"Run docker system df to see which row is big, then docker builder prune or remove old containers
Leaving out the state volumeWithout state.yml Docuum restarts from image creation dates (issue 320, maintainer)Mount ./data:/root as in Step 3
Invalid threshold '15 GB'. (issue 164)Quotes became part of the value, in a systemd Environment="X='15 GB'" lineUse Environment='THRESHOLD=20 GB' and ${THRESHOLD} as in the sample, or a Compose list
GLIBC_2.33' not found on an old Linux (issue 309)The default Linux build needs a newer system libraryUse the ...-linux-musl file from the release
No such file or directory (os error 2) on a Mac service (issue 243)The service PATH did not contain the folder of dockerPut that folder into the plist PATH
A percentage limit on Windows or Mac50% works on Linux only (issue 340)Use an absolute size such as 20 GB
AI assistants: install.ps1, --dry-run, --older-than, --interval, "it cleans build cache and volumes too"Invented, or mixed up with other tools. The flags are --threshold, --keep, --deletion-chunk-size, --min-age, --version; images onlyCheck docuum --help
AI assistants: --min-age 3 monthsMonths and years are rejected since 0.27.4Use days, weeks or hours: --min-age 90d

Tip: --keep matches repository:tag as printed by docker image ls: nginx:1.27.0 for a Docker Hub image, not docker.io/library/nginx:1.27.0. Test your expression against the list from Step 1.

Tip: An image is safe only while a container exists for it. After docker compose down its images can be deleted and are pulled again on the next up. Add --keep for stacks you run only now and then.

Troubleshooting#

ProblemSolution
Container restarts again and againdocker compose logs --tail=100 docuum. A bad limit or regular expression makes Docuum stop at start. Fix the command: list
Nothing is ever deletedYour limit is above the Images row, or all images are in use, --keep or --min-age. Set LOG_LEVEL=trace and read the "Skipping" and "Ignored" lines
Too much is deletedYour limit is below what your stacks need: raise it or add --keep
Cannot connect to the Docker daemonStart Docker first (Docker Desktop on Windows and Mac)
Where is the state file./data/.local/share/docuum/state.yml on the host with our Compose file
Many events, busy CPUUpgrade to 0.27.3 or later, which saves state less often (changelog, issue 426)

Exact error texts#

  • template parsing error: template: :1:2: executing "" at <.Parent>: map has no entry for key "Parent" (issue 358, March 2026): seen with the Alpine system package 0.26.0. The same code built from source worked. Use the container or the release binary.
  • Invalid threshold '15 GB'. (issue 164, 2021): quotes inside the value. Current versions say Invalid absolute threshold ... (source).

Known bugs (open, December 2026)#

Issue 320: on one rootless Docker host Docuum sometimes exits with `docker events` terminated. and the cause is unknown; restart: unless-stopped brings it back. Issue 346: with Podman (not officially supported) 0.25.1 and later stop with unknown container state: restarting: invalid argument; 0.25.0 worked and the issue has a workaround script. See our Podman guide for the tool itself. Nothing we found stops a normal Docker install.

Updates and backups#

Update. Read the changelog for the version you jump to. Change the tag in compose.yaml, then:

Run in terminalbash
cd ~/docker_volumes/docuum
docker compose pull
docker compose up -d
docker compose logs --tail=20 docuum

What to back up. compose.yaml and data (a tiny state file). Without it Docuum restarts from image creation dates, which can change what it deletes first (our reading of the README, not a tested restore).

Linux and Mac#

Save as ~/docker_volumes/docuum/backup.sh:

File contentbash
#!/usr/bin/env bash
set -euo pipefail
base="$HOME/docker_volumes/docuum"
out="$base/backups/docuum-$(date +%F).tar.gz"
tar -czf "$out" -C "$base" compose.yaml data
chmod 600 "$out"

Run chmod 700 on it and add this line with crontab -e (on a Mac write /Users/<your-user>/...):

File contenttext
0 3 * * * /home/<your-user>/docker_volumes/docuum/backup.sh

Windows (PowerShell)#

Save as $HOME\docker_volumes\docuum\backup.ps1:

Codepowershell
$base = "$HOME\docker_volumes\docuum"
$out = "$base\backups\docuum-$(Get-Date -Format yyyy-MM-dd).tar.gz"
tar.exe -czf $out -C $base compose.yaml data

In Task Scheduler run powershell.exe -NoProfile -File <full-path-to-the-script> daily at 03:00.

Restore test#

Stop your real Docuum, unpack the archive in a spare folder and run docker compose up -d there. The log should show Listening for Docker events…. For the volumes of your other apps, see our docker-volume-backup guide.

Performance and resources#

The image is about 16 MB compressed (Docker Hub API). The README says Docuum uses no CPU without Docker activity, and the changelog lists two CPU fixes for hosts with many container events, such as health checks (0.27.2, 0.27.3). We measured no RAM or CPU and the docs give none: run docker stats docuum. --deletion-chunk-size is how many images are removed before it measures again; the default 1 is gentlest.

FAQ#

Does Docuum delete my volumes or databases? No. It removes images only, with docker image rm.

Will it delete the image of a running container? No. It skips every image any container uses, running or stopped, even if that leaves it over the limit.

Can I see what it would delete first? Not in 0.27.4. Start with a high limit (Step 1) and read the debug log.

Is the limit a hard cap? No. Images in use, --keep and --min-age can leave it above.

What about Watchtower or Dockcheck? They update containers or tell you about updates. Docuum frees the space the old images use afterwards.

Sources#

Checked against the official docs on 2026-12-03. Nothing was run on a real machine by DIY Lab Hub; the commands come from the README, the repository files, the program source and the issues above.

Try one of these