Remove docker build cache

Maciej
1 min readFeb 17, 2020

Sometimes an no space lefterror occurred when building Dockerfile .
When I checked the storage capacity used by Docker, it turned out that the build cache was extremely large.

$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 45 6 99.35GB 74.17GB (74%)
Containers 10 6 27.06GB 6.004GB (22%)
Local Volumes 7 1 0B 0B
Build Cache 414 0 41.58GB 41.58GB

I didn’t know how to clear this Build cache immediately, so I’ll leave it as a memo. The conclusion is very simple, you can delete it with the following command ( reference URL ).

$ docker builder prune

After executing this command, docker system dftry ...

$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 25 6 99.35GB 74.17GB (74%)
Containers 8 6 27.06GB 6.004GB (22%)
Local Volumes 3 1 0B 0B
Build Cache 96 0 0B 0B

I was able to erase it safely. If you’re using Docker and you’re worried about remaining storage space, it might be worth a try.

--

--

Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.