Docker/Clean Unused: Difference between revisions

From Fundamental Ramen
Jump to navigation Jump to search
No edit summary
Line 7: Line 7:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
sudo docker image prune
sudo docker image prune
</syntaxhighlight>
|-
| Clean all unused images ||
<syntaxhighlight lang="bash">
sudo docker image prune -a
</syntaxhighlight>
|-
| Clean unused images older than 30 days ||
<syntaxhighlight lang="bash">
sudo docker image prune -a --filter "until=720h"
</syntaxhighlight>
|-
| Clean unused containers, networks, images, and build cache ||
<syntaxhighlight lang="bash">
sudo docker system prune
</syntaxhighlight>
|-
| Clean all unused Docker resources ||
<syntaxhighlight lang="bash">
sudo docker system prune -a
</syntaxhighlight>
|-
| Clean all unused resources including volumes ||
<syntaxhighlight lang="bash">
sudo docker system prune -a --volumes
</syntaxhighlight>
</syntaxhighlight>
|}
|}

Revision as of 02:08, 6 October 2026

Clean Images

🎯 Purpose ⌨️ Command
Clean unused image
sudo docker image prune
Clean all unused images
sudo docker image prune -a
Clean unused images older than 30 days
sudo docker image prune -a --filter "until=720h"
Clean unused containers, networks, images, and build cache
sudo docker system prune
Clean all unused Docker resources
sudo docker system prune -a
Clean all unused resources including volumes
sudo docker system prune -a --volumes