Last active
March 23, 2023 17:30
-
-
Save ludenus/7b9b9a8454389ffdf3f4d8c6798dd5e9 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -e | |
echo "==================== before cleanup: `date --utc --iso-8601=seconds`" | |
df -h | grep -v ^overlay | grep -v ^tmpfs | grep -v ^shm | grep -v /snap/ | |
echo "" | |
if which docker; then | |
echo 'run docker cleanup ... ' | |
docker system prune -a -f --volumes | |
elif which crictl; then | |
echo 'run crictl cleanup ... ' | |
crictl rmi --prune | |
elif which ctr; then | |
ctr -n k8s.io i rm $(ctr -n k8s.io i ls -q ) | |
else | |
echo "ERROR: neither docker nor crictl nor ctr found in PATH:$PATH" | |
fi | |
echo "" | |
echo "==================== after cleanup: `date --utc --iso-8601=seconds`" | |
df -h | grep -v ^overlay | grep -v ^tmpfs | grep -v ^shm | grep -v /snap/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment