Cleaning Up Docker Disk Usage Safely
📰 Medium · DevOps
Learn to safely clean up Docker disk usage by measuring, reclaiming, and troubleshooting to free up space and prevent data loss
Action Steps
- Measure Docker disk usage using the `docker system df` command to identify areas for cleanup
- Reclaim disk space by removing stopped containers, build cache, dangling images, and unused images using commands like `docker container prune` and `docker image prune`
- Troubleshoot common issues like 'No space left on device' and 'overlay2 is huge' by checking disk usage and container logs
- Automate cleanup tasks using scripts and cron jobs to prevent future disk space issues
- Use `docker system prune` to remove unused data and free up space, but be cautious of potential data loss
Who Needs to Know This
DevOps teams and developers who use Docker can benefit from this article to optimize their workflow and prevent disk space issues
Key Insight
💡 Measuring and reclaiming disk space in the right order can help prevent data loss and optimize Docker performance
Share This
💡 Clean up Docker disk usage safely with these steps! 🚀
Key Takeaways
Learn to safely clean up Docker disk usage by measuring, reclaiming, and troubleshooting to free up space and prevent data loss
Full Article
Title: Cleaning Up Docker Disk Usage Safely
URL Source: https://medium.com/@john.nessime/cleaning-up-docker-disk-usage-safely-d0c404af37a4?source=rss------devops-5
Published Time: 2026-07-31T19:52:29Z
Markdown Content:
[Sitemap](https://medium.com/sitemap/sitemap.xml)
[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40john.nessime%2Fcleaning-up-docker-disk-usage-safely-d0c404af37a4&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)
[](https://medium.com/?source=---top_nav_layout_nav-----------------------------------------)
Get app
[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)
[Search](https://medium.com/search?source=---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40john.nessime%2Fcleaning-up-docker-disk-usage-safely-d0c404af37a4&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

1. [Measure before you delete](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#9f2e "Measure before you delete")
2. [Reclaim in order, safest first](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#2b9d "Reclaim in order, safest first")
3. [1. Stopped containers](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#4c33 "1. Stopped containers")
4. [2. Build cache](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#6158 "2. Build cache")
5. [3. Dangling images](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#f4ee "3. Dangling images")
6. [4. Unused images — read this one carefully](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#510c "4. Unused images — read this one carefully")
7. [5. Volumes — the one that loses data](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#e5b2 "5. Volumes — the one that loses data")
8. [The gigabytes Docker never tells you about](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#3b4f "The gigabytes Docker never tells you about")
9. [Truncate, do not delete](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#a8db "Truncate, do not delete")
10. [Then stop it happening again](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#628f "Then stop it happening again")
11. [Automating it without automating a disaster](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#78f4 "Automating it without automating a disaster")
12. [Troubleshooting](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#d051 "Troubleshooting")
13. [Pruned everything, df has not moved](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#23b6 "Pruned everything, df has not moved")
14. [“No space left on device” but df shows free space](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#6eee "“No space left on device” but df shows free space")
15. [overlay2 is huge and I have hardly any images](https://medium.com/?source=post_page-----d0c404af37a4--------------------------------
URL Source: https://medium.com/@john.nessime/cleaning-up-docker-disk-usage-safely-d0c404af37a4?source=rss------devops-5
Published Time: 2026-07-31T19:52:29Z
Markdown Content:
[Sitemap](https://medium.com/sitemap/sitemap.xml)
[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40john.nessime%2Fcleaning-up-docker-disk-usage-safely-d0c404af37a4&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)
[](https://medium.com/?source=---top_nav_layout_nav-----------------------------------------)
Get app
[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)
[Search](https://medium.com/search?source=---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40john.nessime%2Fcleaning-up-docker-disk-usage-safely-d0c404af37a4&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

1. [Measure before you delete](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#9f2e "Measure before you delete")
2. [Reclaim in order, safest first](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#2b9d "Reclaim in order, safest first")
3. [1. Stopped containers](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#4c33 "1. Stopped containers")
4. [2. Build cache](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#6158 "2. Build cache")
5. [3. Dangling images](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#f4ee "3. Dangling images")
6. [4. Unused images — read this one carefully](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#510c "4. Unused images — read this one carefully")
7. [5. Volumes — the one that loses data](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#e5b2 "5. Volumes — the one that loses data")
8. [The gigabytes Docker never tells you about](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#3b4f "The gigabytes Docker never tells you about")
9. [Truncate, do not delete](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#a8db "Truncate, do not delete")
10. [Then stop it happening again](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#628f "Then stop it happening again")
11. [Automating it without automating a disaster](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#78f4 "Automating it without automating a disaster")
12. [Troubleshooting](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#d051 "Troubleshooting")
13. [Pruned everything, df has not moved](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#23b6 "Pruned everything, df has not moved")
14. [“No space left on device” but df shows free space](https://medium.com/?source=post_page-----d0c404af37a4---------------------------------------#6eee "“No space left on device” but df shows free space")
15. [overlay2 is huge and I have hardly any images](https://medium.com/?source=post_page-----d0c404af37a4--------------------------------
DeepCamp AI