Created
June 30, 2025 07:18
-
-
Save lam0819/d2df42ca034598507cc6e06cbe27a2bf to your computer and use it in GitHub Desktop.
docker clear
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo "======== start clean docker containers logs ========" | |
| logs=$(find /var/lib/docker/containers/ -name *-json.log) | |
| for log in $logs | |
| do | |
| echo "clean containers logs : $log" | |
| cat /dev/null > $log | |
| done | |
| echo "======== end clean docker containers logs ========" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 清理只剩下 /var/lib/docker/overlay2 目录占磁盘空间大一些了,使用删除镜像和容器的命令清理 | |
| docker system prune -a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment