0

I recently found out that docker volumes take 80% of my hard drive space and decided to do a cleanup.

The issue is, that I have over 500 different volumes (based on docker volumes list), and I cannot find any information where those volumes belong to. Most of them look like a random set of letters:

$ docker volume list
DRIVER    VOLUME NAME
local     0adc471b7f6e7ae3df9aba8d4709abe0d86b3be19380c857eddcb20a5f9747f1
local     0b4853d197e443f0294990c0ad5c972ddc9201d6f95c75002a4a4e277e998341
local     0bdd60dee042792dea08740743d141e158ac8c9799f1d51d6adf43f9dc7e1cef
local     0c12658640e7d1f30bde86d284cdf8f3d3b33acbc4c52ef9038c21cf034f85c4
local     0ccec559fce8d19c2c94c6b357edf5c76ebe257bc72e7f808c464fd03aea75e4
local     0d0b79ac40e29cd7a73f50e36b2f5174feed62df92311c7ac55097f4e2e6af73
local     0e8ff01ac51f21f107f76c6e7cd8332210ccf9cc3a81c75e4a32727469ccb528
local     0e24bb467d977a1c58107a2a14205851c5f1731694b5351f5e2673d3e67745fe
local     0e692a1ddedbf8dbbd6e976dc2ff1bfd82dedb76bade4156fb00abc3f77ca41e
local     0f90bc0f1b42d26e382894f85e7eb4c1b18b7ea5bbb4b4514b8eb9749b6f63ff

Even inspect tells nothing about the volume.

$ docker volume inspect 0adc471b7f6e7ae3df9aba8d4709abe0d86b3be19380c857eddcb20a5f9747f1
[
    {
        "CreatedAt": "2021-05-17T12:59:57+02:00",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/0adc471b7f6e7ae3df9aba8d4709abe0d86b3be19380c857eddcb20a5f9747f1/_data",
        "Name": "0adc471b7f6e7ae3df9aba8d4709abe0d86b3be19380c857eddcb20a5f9747f1",
        "Options": null,
        "Scope": "local"
    }
]

Is there any way to get the container specific volume belongs to and possibly also its size?

I don't want to accidentally remove a volume I need.

HubertNNN
  • 1,727
  • 1
  • 14
  • 29
  • (One thing I might suspect here is unnecessary use of the Dockerfile `VOLUME` directive, which can create a new anonymous volume like this every time the container runs.) – David Maze Sep 08 '21 at 13:07
  • 2
    Also notice that you won't find that information by inspecting the volume itself, because a volume doesn't "belong" to a container, it can be "used" by a container. In fact, the same volume can be used by multiple containers. – cornuz Sep 08 '21 at 13:09

0 Answers0