1

Out of the 148 GB disk space of my Compute Engine Instance, /home folder is taking up only 55 GB whereas /var/lib/docker/containers is taking up a total of 69 GB, which is too much of disk space usage IMO. How do I free up the disk space used by docker?

I tried docker system prune, but it is saying Total reclaimed space: 0B and is not cleaning up the disk.

Also docker system df is showing only 670 MB space usage as shown below:

TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              1                   1                   670.4MB             0B (0%)
Containers          1                   1                   0B                  0B
Local Volumes       0                   0                   0B                  0B
Build Cache         0                   0                   0B                  0B

Then what is taking up all that space? I am confused.

Any help is appreciated.

2 Answers 2

2

Use the command docker system df to show what is taking up the most space.

docker system df
TYPE                TOTAL               ACTIVE              SIZE                RECLAIMABLE
Images              19                  3                   15.62GB             9.883GB (63%)
Containers          8                   5                   296.3MB             220B (0%)
Local Volumes       12                  12                  10.78GB             0B (0%)
Build Cache         0                   0                   0B                  0B

From there, docker system prune should clean up unused items. If the items are not cleaned up, its likely because docker still considers them 'in use'. You will need to manually free them up, or use the more aggressive prune commands

Warning: These commands may do things you don't expect

docker system prune --all
docker system prune --volumes #(This may delete data you aren't expecting)

Other helpful commands

Images

docker image list
docker rm <id of image you wish to delete>

Containers

docker ps -all

Volumes

docker volume list
1
  • Thanks. docker system df is showing only 670 MB space usage. I updated the question to add this information. I don't know why then /var/lib/docker/containers take up a total of 69 GB. Weird. :-|
    – Safwan
    Feb 7, 2020 at 13:36
0

I found a Stackoverflow that might be helpful.

The "$ docker system prune" command removes all stopped containers, unused networks, dangling images, and build cache.

So I want to believe that if those are not available the command might not work

1
  • This seems to be useful link
    – Adebisi
    Feb 10, 2020 at 19:55

You must log in to answer this question.

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