FEATURE: Check disk space on launcher script
authorRafael dos Santos Silva <xfalcox@gmail.com>
Thu, 29 Jun 2017 01:01:44 +0000 (22:01 -0300)
committerRafael dos Santos Silva <xfalcox@gmail.com>
Thu, 29 Jun 2017 01:01:44 +0000 (22:01 -0300)
launcher

index 850041abe6580917cd3e94249e1f7e25731c8136..ff243dd52d3ac2715112f5de52d5c0cfad4f2c93 100755 (executable)
--- a/launcher
+++ b/launcher
@@ -196,6 +196,22 @@ check_prereqs() {
     exit 1
   fi
 
+  # 7. enough space for the bootstrap on docker folder
+  folder=`docker info --format '{{(index (index .DriverStatus 0) 1)}}'`
+  safe_folder=${folder:-/var/lib/docker/aufs}
+  test=$(($(stat -f --format="%a*%S" $safe_folder)/1024**3 < 5))
+  if [[ $test -ne 0 ]] ; then
+    echo "You have less than 5GB of free space on the disk. You will need more space to continue"
+    echo
+    read -p "Would you like to attempt to recover space by cleaning docker images and containers in the system?(y/N)" -n 1 -r
+    echo
+    if [[ $REPLY =~ ^[Yy]$ ]]
+    then
+      docker system prune
+      echo "If the cleanup was successful, you may try again now"
+    fi
+    exit 1
+  fi
 }