TL;DR: Find the container holding the volume (`docker ps -a --filter volume=mydata`), remove it (`docker rm`), then `docker volume rm mydata` succeeds. Stopped containers keep their volume references, so `docker stop` is not enough.

## The error

```text
Error response from daemon: remove mydata: volume is in use - [c3d4e5f6...]
```

## Fix it

1. Find the referencing containers:
   `docker ps -a --filter volume=mydata`
   Expected: one or more containers, possibly exited.
2. Remove them (add -f if running and you are sure):
   `docker rm [container]`
   Expected: no output.
3. Remove the volume:
   `docker volume rm mydata`
   Expected: prints `mydata`.

## When this applies
- `docker volume rm` / `docker volume prune` skipping a volume
- Rebuilding stateful dev environments

## When this does NOT apply
- Anonymous volumes (they have hex IDs; same fix, filter by the ID)
- "No such volume" (already gone)

## Versions
All Docker versions.

## Why it happens
Volumes are reference-counted. Any container created with the volume, running or stopped, holds a reference until the container itself is removed. Prune only removes truly unreferenced volumes.

## Edge cases
- `docker rm -v` removes anonymous volumes attached to the container at removal time; named volumes survive unless explicitly removed.
- Compose `down -v` removes the project's named volumes; plain `down` keeps them, which is why the next `up` sees old data.
- A container stuck in removal holds the reference; restart the daemon to clear it.
