0

I need to know which docker (running or not) is associated to the big directory /var/lib/docker/containers/$ID/ :

$ id=d28ebf088353dd7135488f447df2a2be6f7bc84df44298bc1a869a78d8a943f2
$ du -sh /var/lib/docker/containers/$id/
21G     d28ebf088353dd7135488f447df2a2be6f7bc84df44298bc1a869a78d8a943f2/
$ docker image ls -a --no-trunc | grep $id
$ docker images -a --no-trunc | grep $id
$
4
  • ps -e | grep dockerd will find you Docker's process ID; there should normally be only one. You should almost never have reason to look in /var/lib/docker; what's your actual goal with this sequence?
    – David Maze
    Sep 8, 2022 at 11:19
  • @DavidMaze The filesystem / is full.
    – SebMa
    Sep 8, 2022 at 12:51
  • @DavidMaze Your command does not tell me which docker object is using the directory /var/lib/docker/containers/$id/.
    – SebMa
    Sep 8, 2022 at 12:51
  • How to analyze disk usage of a Docker container suggests docker ps --size (and, again, completely ignoring /var/lib/docker). This doesn't really seem like a programming-related question, though.
    – David Maze
    Sep 8, 2022 at 13:12

1 Answer 1

1

If the question is 'how do I know which container owns this directory", then you just need to pass your id to the ps filter:

docker ps -a -f $id

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .