Forráskód Böngészése

Merge pull request #855 from h3xx/simplify-mem-check

Mark Shust 2 éve
szülő
commit
523bd17dda
1 módosított fájl, 4 hozzáadás és 3 törlés
  1. 4 3
      compose/bin/setup

+ 4 - 3
compose/bin/setup

@@ -1,9 +1,10 @@
 #!/bin/bash
 #!/bin/bash
 set -o errexit
 set -o errexit
 
 
-MEM=$(docker info | grep "Total Memory" | cut -d':' -f2 | xargs | sed s/GiB//)
+MEM_BYTES=$(docker info -f '{{.MemTotal}}')
-# Docker reports RAM 0.2 less than what it is actually set to
+MEM_MB=$(( MEM_BYTES / 1000000 ))
-(( $(echo "$MEM < 5.7" | bc -l) )) && echo "There must be at least 6GB of RAM allocated to Docker to continue." && exit
+# When Docker Desktop is set to 6GB in the GUI, it is reported as 6227 MB
+(( MEM_MB < 6227 )) && echo "There must be at least 6GB of RAM allocated to Docker in order to continue." && exit
 
 
 # shellcheck source=../env/db.env
 # shellcheck source=../env/db.env
 source env/db.env
 source env/db.env