If you’ve installed docker/boot2docker on Mac OS X and are getting no space left on device errors, you’re likely to have already come across some arcane instructions for increasing boot2docker volume size. If you’ve already tried removing untagged docker images and are still running into space issues (maybe you’re just trying to build something really big?), you can actually very easily change your boot2docker volume size by editing your boot2docker configuration.1 2
Add the following line(s) to ~/.boot2docker/profile (creating it if it’s not already there):
# Disk image size in MB
DiskSize = 100000
This would give you a boot2docker VM with ~100GB of disk.
If you’d also like to run memory-intensive jobs with docker (you can change the memory limit of an individual docker run command with the -m flag), you can also add a line like:
Memory = 8192
To give you a boot2docker VM with 8GB of memory, for example.
In order for these changes to take effect, you need to destroy your boot2docker VM and recreate it:
⚠︎ WARNING: THIS WILL DELETE ANY AND ALL LOCAL DOCKER CONTAINERS, IMAGES, AND LAYERS YOU HAVE NOT PUSHED ⚠︎
boot2docker stop
boot2docker destroy
boot2docker init
boot2docker start
Verify changes with boot2docker config or by ssh’ing into the boot2docker VM with boot2docker ssh and using e.g. df -h or cat /proc/meminfo.
Footnotes:
-
With the release of
docker-machine, that’s probably how you’re runningdockerunder OS X now and these instructions no longer apply. However, if you were previously runningboot2dockerand follow thedocker-machinemigration instructions, any changes you made toboot2dockerdisk and memory sizes should carry over. With thedocker-machineVirtualBox driver, you should be able to use--virtualbox-disk-sizeand--virtualbox-memoryas arguments todocker-machine create -d virtualbox; presumably, you can do the samestop/rm/create/startcycle around this. ↩ -
With the release of Docker for Mac, the method for resizing the available disk space for containers/images has changed yet again. Apparently Docker for Mac defaults to a 64GB sparse disk image. The following instructions may work for resizing it: https://forums.docker.com/t/consistently-out-of-disk-space-in-docker-beta/9438/46 ↩