martes, 26 de abril de 2016

Docker (docker-machine) build and disk space notes (Windows)

Docker Toolbox version: 1.10.3
Docker info server version: 1.10.3
Operating System: Boot2Docker 1.10.3
Windows: 7

Working with somewhat big images, I started receiving disk space errors when running docker build ("no space left on device" when executing ADD, etc.). Although my images are big, I knew they're not that big to fill the default 20GB Docker Machine Virtual Box VM disk (located in C:\Users\[User]\.docker\machine\machines\default), so before resizing its VirtualBox vmdk file, I started looking around.


I ssh'ed to the docker-machine host:

docker-machine.exe ssh


Tracing the wasted disk space (df -k, du -sh *,...) I ended up in the /mnt/sda1/var/lib/docker/tmp directory.


(note: the screenshots doesn't reflect the actual disk space in the problem's instant).

The docker user doesn't have permissions to see that directory, so you need to sudo sh.



I noticed several large docker-builder* directories storing the context for building some of my images (the Dockerfile and installers and assets needed by the build, etc....). After doing some tests building images, I noticed this directory is really a temporary directory (duh) and should not contain those docker-builder* folders if you are not actually building images (as I was not at the moment).

I deleted the folders, re ran the builds and they finished without space problems.

What caused docker not removing those temporary directories automatically? Maybe some Ctrl-C's I did when just "Sending build context to Docker daemon..." or interrupted builds?

No hay comentarios: