Interview Prep/Docker/Volumes, storage and data

You need to find which container is using a volume before deleting it.

BeginnerScenarioVolumes, storage and data
Answer

Situation read → docker volume rm fails with "volume is in use".

What I'd do →

docker ps -a --filter volume=pgdata --format '{{.ID}} {{.Names}} {{.Status}}'
docker volume inspect pgdata

Stop and remove the referencing containers, then docker volume rm pgdata.

Why → Stopped containers still hold references.

Interview tip → docker volume prune removes unused volumes (anonymous only unless -a); never run it blindly in prod.

All Docker questions Roadmap: Docker & containers

More on Volumes, storage and data