- Published on
Clearing Docker Volumes to Free Up Space
- Authors
- Name
- Yair Mark
- @yairmark
Yesterday I spoke about setting up aliases to more easily work with docker as well as free up space. Today I kept running into space issues on Ubuntu where it warned me I had 1GB left. I checked the disk space tool that comes with Ubuntu and could not see the majority of my hard disk I could only see about 30%.
I figured this must be happening as the tool does not have rights on most folders on the machine (i.e. it needs to be run using sudo
). After doing a bit of Googling I came across this post and in particular the comment below this answer:
best answer. also: sudo ncdu -rx / should give a clean read on biggest dirs/files ONLY on root area drive. (-r = read-only, -x = stay on same filesystem (meaning: do not traverse other filesystem mounts) )
sudo ncdu -rx /
Running this command as suggested in the comment I saw that docker volumes were using up about 60% of my hard disk. I searched a bit more and came across this github page. In the end based on this I used the command below to free up 60% more space on my hard disk. The majority of the docker volumes were not needed anyway.
docker volume rm $(docker volume ls -qf dangling=true)