0

I have a lot of volumes in Docker that don't have an owner anymore. I'm really curious who keeps creating them, but I cannot figure it out. The volumes are empty inside, so I cannot determine it from their content.

And when I run docker volume inspect I get something like this:

[
    {
        "CreatedAt": "2022-05-17T02:56:30+02:00",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/mnt/storage/docker/volumes/4db244d1741392b730eb4de50ce492ba2b19973aaef51bc5eaa41b4739c246e9/_data",
        "Name": "4db244d1741392b730eb4de50ce492ba2b19973aaef51bc5eaa41b4739c246e9",
        "Options": null,
        "Scope": "local"
    }
]

It seems really weird to me that Docker doesn't even record the name of the creator, so am I missing something? How do I track down the previous owner?

David Maze
  • 130,717
  • 29
  • 175
  • 215
Maestro
  • 9,046
  • 15
  • 83
  • 116
  • Can you provide a [mcve] with enough source code to demonstrate this issue? For example, I could easily see a Dockerfile with an unnecessary `VOLUME` directive causing this. – David Maze May 18 '22 at 00:31
  • @DavidMaze To be honest this isnt really a programming question. I just have 15 containers running that I downloaded and one of them is creating these ghost volumes. So there is not any sourcecode involved. – Maestro May 18 '22 at 00:55
  • A volume doesn't have a "creator" or an "owner". Volumes can be created directly, without involving any containers. You can see what volumes are attached to *running* containers by using `docker inspect`, but there's nothing like a history of containers to which a volume was previously attached. – larsks May 18 '22 at 03:22
  • @larsks It would be really helpful if this "attachment history" was kept somewhere. Do you have any other suggestions how to debug this? – Maestro May 18 '22 at 11:02
  • Those volumes are created by images that include a `VOLUME` declaration in their Dockerfile. You can `docker image inspect` to see if an image will create any volumes ([like this](https://stackoverflow.com/a/32001068/147356)). – larsks May 18 '22 at 11:47

0 Answers0