Problem:
As I download and run containers, they keep taking up more and more space. I found suggestions for cleaning up unused containers and images and I did so. Guess what? They eat up even more disk space!
What I found so far:
It has to do with .docker\machine\machines\default\disk.vmdk
file. It only gets bigger!
Log of disk.vmdk:
size (MB)
1. with 2 images 1,376
2. downloading a new image X ?
3. running X as Y 2,963
4. removing Y 2,963
5. removing X 3,106
6. removing all the images 3,126
The only fix I found so far was running docker-machine rm default
which removes the VM. The problem is that I have to download all the images again. There should be a better fix. Can someone explain:
- What is going on?
- How to fix it?
There are maintainance commands you can run on the more recent versions of Docker. They will free up space used by stopped containers, dangling images and dangling volumes:
Maybe the images you are using, use volumes. If they do then deleting the container doesn't do the trick. You must delete the volumes as well. In order to do that you must specify the
-v
flag when deleting a containerDepending on your docker version you will have some more commands available. Check this SO thread for more. You can read more about orphaned volumes in this SO thread