Docker Takes A Lot of Space. Use Docker Prune To Reclaim It.
Docker images, both big and small, take space on your hard drive.
Constantly creating — or, “building” in the development operations “DevOps” parlance takes even more space. Each “build”, a.k.a.
docker build or
docker-compose build creates a new or multiple new Docker images. The previously built images don’t necessarily go anywhere, consuming more and more precious hard disk space. While today’s machines are coming with a few Terabytes of storage space, it still adds up. Not to mention it makes the output from the
docker images command harder to read. Compare this to this.
There’s this little command that I’m going to tell you about that will let you go from bloat to gloat.
docker system prune
Docker system prune allows you to remove “orphaned” or “dangling” images form old Docker builds your system is no longer using, along some of their associated build artifacts (unused networks, build caches, etc.).
How much space I saved when s̶w̶i̶t̶c̶h̶i̶n̶g̶ ̶t̶o̶ ̶G̶e̶i̶c̶o̶ using system prune?
That’s it! Happy Dockerizing.