Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to claim free space generated by deleting docker images in Mac

Tags:

docker

I started using docker images and suddenly i realized lack of space. It took me a while to know that space is being consumed by docker images. So I deleted all the running containers and unnecessary images only to realize that the result of df -h is still the same. I could see ~/.docker/machine/machines/default/disk.vmdk still occupying 25GB of space (no change). How can I reclaim the freed space occupied by virtual box image. I am using Mac Yosemite and docker tool (not boot2docker)

like image 955
Vikram3891 Avatar asked Feb 03 '16 09:02

Vikram3891


People also ask

How do I clean up unused docker images?

To clean this up, you can use the docker container prune command. By default, you are prompted to continue. To bypass the prompt, use the -f or --force flag. Other filtering expressions are available.

How do I remove docker images from my Mac?

Go to the Applications folder in Finder and find and remove the Docker app to Trash. Now you need to find and remove all application support files of Docker. They are usually stored in the Library folder. As the system Library folder keeps important data, by default, it is hidden from users.


1 Answers

You have to remove the machine. Use

docker-machine rm default

(default is the name of the default docker-machine)

Beware that you will delete all the images in this way.

There might be ways to compact disk image size (look at this question), but I don't think it worth the hassle. Instead recreate it with a smaller disk size.

Just to be clear, removing the containers and images only save space inside the VM. You can anyway in the future run into trouble because old unused images and container volumes might fill your VM disk. There are actions to be taken to keep it under control, the first of all is always removing containers with the -v flag.

like image 116
Teudimundo Avatar answered Oct 02 '22 05:10

Teudimundo