Docker is in volume in use, but there aren't any Docker containers

Tkwon123 picture Tkwon123 · Jan 7, 2016 · Viewed 95.1k times · Source

I've been having issues with removing Docker volumes with Docker 1.9.1.

I've removed all my stopped containers so that docker ps -a returns empty.

When I use docker volume ls, I'm given a whole host of Docker containers:

docker volume ls
DRIVER              VOLUME NAME
local               a94211ea91d66142886d72ec476ece477bb5d2e7e52a5d73b2f2f98f6efa6e66
local               4f673316d690ca2d41abbdc9bf980c7a3f8d67242d76562bbd44079f5f438317
local               eb6ab93effc4b90a2162e6fab6eeeb65bd0e4bd8a9290e1bad503d2a47aa8a78
local               91acb0f7644aec16d23a70f63f70027899017a884dab1f33ac8c4cf0dabe5f2c
local               4932e2fbad8f7e6246af96208d45a266eae11329f1adf176955f80ca2e874f69
local               68fd38fc78a8f02364a94934e9dd3b5d10e51de5b2546e7497eb21d6a1e7b750
local               7043a9642614dd6e9ca013cdf662451d2b3df6b1dddff97211a65ccf9f4c6d47
#etc x 50

Since none of these volumes contain anything important, I try to purge all the volumes with docker volume rm $(docker volume ls -q).

In the process, the majority are removed, but I get back:

Error response from daemon: Conflict: volume is in use
Error response from daemon: Conflict: volume is in use
Error response from daemon: Conflict: volume is in use
Error response from daemon: Conflict: volume is in use
Error response from daemon: Conflict: volume is in use

For a sizeable portion of them. If I don't have any containers existing in the first place, how are these volumes being used?

Answer

Robert K. Bell picture Robert K. Bell · Sep 14, 2018

Perhaps the volume was created via docker-compose? If so, it should get removed by:

docker-compose down --volumes

Credit to Niels Bech Nielsen!