Azure Docker: No space left on disk

This took me too long to figure out NOT to write a blog post about it 必

My Azure build pipeline builds several docker images as part of it’s process (multiple artifacts and tests).
For some reason, recently it started to fail with “no space left on device”.

No space left 對 No space left 對 No space left 對
No space left 對

I tried to slim down the images I was building, etc to no avail.
Eventually, I came across: docker system df which lists what space docker “owns”.

Such build, so yuge! Such build, so yuge! Such build, so yuge!
Such build, so yuge!

The images looks about right but wow…that build cache is yuge.

yuge

According to the docs Azure agents only have 10gb space for the jobs, so I’m guessing it gets a bit of wiggle room for the docker build cache.

Regardless, my solution was to run docker system prune -f as a pipeline step to clear the cache half way through the process.
That does mean the latter images needed a full rebuild, but it also means the build works 簪\_()_/簪

Tags: azure docker