How to claim free space created by deleting docker images on Mac

I started using dockers, and suddenly I realized that there was not enough space. It took me a while to realize that space is being consumed by images of dockers. Therefore, I deleted all running containers and unnecessary images only in order to understand that the result of df -h still the same. I could see that ~/.docker/machine/machines/default/disk.vmdk still takes up 25 GB of space (no change). How can I return the freed space occupied by the image of the virtual window. I use Mac Yosemite and a boot2docker tool (not boot2docker )

+7
docker
source share
2 answers

You need to remove the car. Use

 docker-machine rm default 

( default is the default name of the dock)

Beware that you delete all images in this way.

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

To be clear, removing containers and images saves space inside the virtual machine. In any case, you may run into problems, because old unused images and container volumes can fill your disk with a virtual machine. There are measures that need to be taken to keep it under control, first of all, it always removes containers with the -v flag.

+11
source share

Resizing Boot2Docker Drives http://learningdocker.com/resizing-boot2docker-disk-volumes/

As indicated on the official Dockers website, the solution is to resize the disk space using a hard disk partitioning tool called Gnome Partition Editor (GParted). Available as a free bootable ISO, GParted is a free partition manager that allows users to resize, copy and move partitions without data loss. The version of GParted used in this tutorial is gparted-live-0.20.0-2-i486.iso.

1) Stop the Boot2Docker virtual machine.

 Host% boot2docker stop 

2) The installer of the Boot2Docker package comes with a VMDK volume that VirtualBoxs native tools cannot resize. To resize a Boot2Docker disk volume, first clone the VDI volume from the default VMDK volume.

 Host% vboxmanage clonehd /full/path/to/boot2docker-vm.vmdk /full/path/to/boot2docker-vm.vdi --format VDI --variant Standard # For Boot2Docker installations using the default settings, "/full/path/to/" # is typically "~/VirtualBox\ VMs/boot2docker-vm/". This tutorial will assume # "/full/path/to/" to be "~/VirtualBox\ VMs/boot2docker-vm/". Host% vboxmanage clonehd ~/VirtualBox\ VMs/boot2docker-vm/boot2docker-vm.vmdk ~/VirtualBox\ VMs/boot2docker-vm/boot2docker-vm.vdi --format VDI --variant Standard 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Clone hard disk created in format 'VDI'. UUID: f37d6330-c6f3-4a2d-914b-f61c3249ca0b 

3) Resize the newly cloned VDI volume to the desired capacity. We recommend at least 64 GB.

 Host% vboxmanage modifyhd ~/VirtualBox\ VMs/boot2docker-vm/boot2docker-vm.vdi --resize <size in MB> 
+1
source share

All Articles