system "docker stop #{container} && docker rm -f #{container}" end
+def set_available_memory
- memory = `awk '($1 == "MemTotal:"){print $2/1048576}' /proc/meminfo`.to_i
if possible, avoid use linux/unix command. you can use File.readlines(file).find to get the line, and then handle the line
ok
Thanks, Yinsi
Thanks, Luan Shengde
- # set container available memory size, minimum size is 1g, maximum size is 30g, take the middle value according to the system memory size.
- [1, 30, Math.sqrt(memory)].sort[1].to_i
+end
2.23.0