See Ash Code logo See Ash Code

An orphaned Docker volume still had a database inside

Ashlynn Antrobus
• • 3 min read

Docker called a volume orphaned. Inside it was a PostgreSQL data directory.

An open treasure chest filled with coins and jewels.

Treasure chest, from WPClipart, public domain.

That was the problem with treating my October cleanup as a count of unused objects. A volume without a container reference could be disposable test debris, a database from a stopped service or the only remaining copy of something I’d forgotten about.

The first audit found 238 volumes: one attached to a running credentials database, one belonging to stopped Firefly, and 236 classified as orphaned. That classification told me about container references. It didn’t tell me what to delete.

The contents supplied the next set of labels

PG_VERSION, base and pg_wal identified PostgreSQL clusters. dump.rdb suggested Redis snapshots. Other directories contained Jellyfin configuration, SQLite databases and a transcode directory.

I used those signatures alongside Compose labels and actual consumers. The early retention decisions looked like this:

Data or ownerConsumer at that stageDisposition
Credentials PostgreSQL volumeRunning credentials databaseKeep
Firefly database volumeStopped Firefly containerKeep out of automatic orphan cleanup
PostgreSQL 15/16 anonymous clustersNo attached container; I identified them as retiredRemove after explicit classification
PostgreSQL 17 clustersOwnership still needed checkingHold for investigation
Old Jellyfin configurationCurrent storage not yet verifiedPreserve while checking active mounts
Empty volumes and tiny Redis snapshotsReviewed cleanup candidatesIncluded in the first removal batch

Version and size were clues, not retention policies. An old PostgreSQL image disappearing from the machine wouldn’t, by itself, prove its data was unneeded.

Jellyfin was running, just somewhere else

The Jellyfin directories initially looked like leftovers from an application I no longer used. I corrected that assumption: Jellyfin was actively running.

Inspecting its mounts resolved the apparent contradiction. The current container used host bind mounts, including /etc/jellyfin for configuration, /var/cache/jellyfin for cache and /srv/media for media. The anonymous volumes belonged to an earlier deployment.

The old configuration still contained meaningful application data and was kept out of the first cleanup. The empty transcode volume could go. The active container’s mount list was better evidence than recognizing a familiar directory name.

The counts described different stages

The first reviewed removal batch contained 145 volumes and brought the total down to 93. Further database cleanup followed. The separate October 20 inventory recorded 32 volumes, with three attached and twenty-nine unused. Those are snapshots of a changing system, rather than competing answers to one count.

The broader disk cleanup also reclaimed image and build-layer storage, including about 13 GB of abandoned oneAPI components. Reported partition use fell from 80% to 48%, but that whole reduction can’t be attributed to deleting volumes.

I listed the workloads I planned to move in the ownership map. Firefly posed a different question because its container was stopped and its database was still there.

AA

Written by Ashlynn Antrobus

Software developer, author, and builder. Sharing technical lessons learned from building tools like Ebook2Text, IndexedDict, and rag-mcp, and navigating life as a programmer with dyslexia.