清理docker构建缓存builder cache
1. The Quick & Safe Way (Recommended)
To clear out the unused build cachewithout disrupting anything currently running, use:
1 | docker builder prune |
- What it does: It removes all dangling/unused build cache.
- What happens: Docker will ask for a confirmation (
y/N). Once confirmed, it deletes the cache and shows you exactly how much space was freed.
2. The Nuclear Option (Clear Everything Cache)
By default, docker builder prune only deletes cache for internal/dangling images. If you want to wipe the entire build cache to start completely fresh, add the -a (all) flag:
1 | docker builder prune -a |
⚠️ Note: This will delete the cache for all builds, meaning your next
docker buildwill take longer because it has to download and re-compile everything from scratch.