cleaning-wsl-docker

Reclaim SSD space by pruning Docker and compacting WSL2 VHDX files.

1|Updated Jul 22, 2025
One-click install
npx skills add https://github.com/Danik911/thesis_project --skill cleaning-wsl-docker
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cleaning-wsl-docker
Source: https://github.com/Danik911/thesis_project/tree/main/.claude/skills/cleaning-wsl-docker
Command: npx skills add https://github.com/Danik911/thesis_project --skill cleaning-wsl-docker

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reclaims SSD disk space consumed by WSL2 and Docker, addressing issues like "disk full", "out of space", or VHDX growth. It bundles disk space diagnostics with prune, cache cleanup, VHDX compaction guidance, and a preventive setup to keep space under control.

Core Features & Use Cases

  • Disk space diagnosis: identifies ext4.vhdx growth and Docker usage that contribute to bloating.
  • Cleanup & prune: runs Docker prune, cache cleanup, and unbounded logs removal inside WSL.
  • VHDX maintenance: guides VHDX compaction steps and Windows-side optimization.
  • Preventive setup: configures WSL to reclaim space automatically (sparse VHD, maintenance cadence).

Quick Start

Diagnose space usage and run cleanup as described in this Skill. For example:

  1. Diagnose VHDX and Docker usage in PowerShell, 2) Run prune and cache cleanup commands, 3) Follow compact-wsl steps to shrink VHDX, 4) Enable sparse VHD reclaim in .wslconfig and restart WSL.

Frequently Asked Questions about cleaning-wsl-docker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I free up disk space on WSL2 when Docker is consuming too much storage?

Docker prune and cache cleanup reclaim space by removing unused images, containers, and build cache inside WSL. Run `docker system prune` and `docker builder prune` to delete dangling artifacts, then check ext4.vhdx size in PowerShell to confirm space recovery before compacting the virtual disk.

Why is my WSL2 ext4.vhdx file growing so large and how do I shrink it?

The ext4.vhdx grows as Docker stores images, containers, and logs. Shrink it by running cleanup commands inside WSL, then use Windows PowerShell compact steps to reclaim unused space from the virtual disk file itself, restoring SSD capacity.

Can I automatically reclaim disk space in WSL2 and Docker instead of manual cleanup?

Yes, configure preventive maintenance by enabling sparse VHD reclaim and setting up automatic cleanup cadence in .wslconfig. Restart WSL to apply these settings, which help maintain space automatically without repeated manual intervention.

How do I diagnose which Docker images and containers are using the most disk space?

Use Docker commands like `docker system df` and `docker image ls` inside WSL to identify large images and unused containers, then cross-check against ext4.vhdx size diagnostics in PowerShell to pinpoint storage bottlenecks before cleanup.

What should I do if Docker builds fail due to out-of-space errors on WSL2?

Diagnose ext4.vhdx and Docker usage, run Docker prune and cache cleanup to free space, then compact the VHDX file. Afterward, enable preventive sparse VHD configuration to prevent future build failures from disk exhaustion.