Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy
Docker

Docker: Use Docker System to Clean Up Unused Resources

- 21.06.26 - ErcanOPAK

🗑️ Docker Eats Disk Space

Unused images, containers, volumes fill disk. docker system prune cleans everything. Reclaim disk space.

📝 Prune Commands

# Clean everything
docker system prune -a --volumes

# Clean containers
docker container prune

# Clean images
docker image prune -a

# Clean volumes
docker volume prune

# Clean networks
docker network prune

# Clean build cache
docker builder prune

# See disk usage
docker system df

# Auto-prune in Docker Desktop
Settings → Docker Engine → add:
"builder": { "gc": { "enabled": true } }

🎯 Scheduled Cleanup

#!/bin/bash
# /usr/local/bin/docker-cleanup.sh

echo "Starting Docker cleanup at $(date)"
docker system prune -af --volumes
echo "Cleanup complete"

# Add to crontab (runs every Sunday at 2 AM)
0 2 * * 0 /usr/local/bin/docker-cleanup.sh >> /var/log/docker-cleanup.log 2>&1

💡 Tips

  • Use –filter to prune only old items (until=24h)
  • Use –force to skip confirmation
  • Use –all to remove all unused images
  • Use –volumes to include volumes (be careful!)

“120GB disk showed 5GB free. docker system df revealed 80GB of unused images. docker system prune -a freed 75GB. Disk space recovered in seconds.”

— DevOps Engineer

Related posts:

Docker: Use Docker Registry for Image Storage

Docker: Why You Should COPY package.json BEFORE the Rest of Your App

Docker Containers Work Locally but Fail in CI

Post Views: 5

Post navigation

Kubernetes: Extend Kubernetes with Custom Resource Definitions
AI Prompt: Generate Attention-Grabbing Blog Post Titles

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

July 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Jun    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (960)
  • How to add default value for Entity Framework migrations for DateTime and Bool (898)
  • How to make theater mode the default for Youtube (857)
  • Get the First and Last Word from a String or Sentence in SQL (840)
  • How to select distinct rows in a datatable in C# (814)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (597)
  • Add Constraint to SQL Table to ensure email contains @ (582)
  • Average of all values in a column that are not zero in SQL (545)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (512)
  • Find numbers with more than two decimal places in SQL (460)

Recent Posts

  • C#: Use Using Statements for Resource Management
  • C#: Use Lambda Expressions for Concise Code
  • SQL: Use GROUP BY for Data Aggregation
  • .NET Core: Master Routing for Clean URLs
  • Git: Use Reset to Undo Local Changes
  • Ajax: Use Axios for HTTP Requests
  • JavaScript: Understand Hoisting
  • HTML: Use Web Storage for Client-Side Data
  • CSS: Use Filter Effects for Visual Magic
  • Windows 11: Unlock God Mode for All Settings

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (960)
  • How to add default value for Entity Framework migrations for DateTime and Bool (898)
  • How to make theater mode the default for Youtube (857)
  • Get the First and Last Word from a String or Sentence in SQL (840)
  • How to select distinct rows in a datatable in C# (814)

Recent Posts

  • C#: Use Using Statements for Resource Management
  • C#: Use Lambda Expressions for Concise Code
  • SQL: Use GROUP BY for Data Aggregation
  • .NET Core: Master Routing for Clean URLs
  • Git: Use Reset to Undo Local Changes

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com