This repository was archived by the owner on Oct 11, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 55echo " --- ROCm info"
66rocminfo
77
8+ # cleanup older docker images
9+ cleanup_docker () {
10+ # Get Docker's root directory
11+ docker_root=$( docker info -f ' {{.DockerRootDir}}' )
12+ if [ -z " $docker_root " ]; then
13+ echo " Failed to determine Docker root directory."
14+ exit 1
15+ fi
16+ echo " Docker root directory: $docker_root "
17+ # Check disk usage of the filesystem where Docker's root directory is located
18+ disk_usage=$( df " $docker_root " | tail -1 | awk ' {print $5}' | sed ' s/%//' )
19+ # Define the threshold
20+ threshold=70
21+ if [ " $disk_usage " -gt " $threshold " ]; then
22+ echo " Disk usage is above $threshold %. Cleaning up Docker images and volumes..."
23+ # Remove dangling images (those that are not tagged and not used by any container)
24+ docker image prune -f
25+ # Remove unused volumes
26+ docker volume prune -f
27+ echo " Docker images and volumes cleanup completed."
28+ else
29+ echo " Disk usage is below $threshold %. No cleanup needed."
30+ fi
31+ }
32+
33+ # Call the cleanup docker function
34+ cleanup_docker
35+
836echo " --- Resetting GPUs"
937
1038echo " reset" > /opt/amdgpu/etc/gpu_state
You can’t perform that action at this time.
0 commit comments