Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why removing docker containers and images does not free up storage space on Windows? How to fix it?

Tags:

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:

  1. What is going on?
  2. How to fix it?
like image 778
Thoran Avatar asked Apr 22 '16 17:04

Thoran


People also ask

How do I get rid of unused docker volumes?

Volumes are removed using the docker volume rm command. You can also use the docker volume prune command.


1 Answers

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:

docker container prune -f docker image prune -f docker volume prune -f 
like image 50
Arnaud Weil Avatar answered Oct 25 '22 19:10

Arnaud Weil