File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,21 @@ if [[ "$CONTAINER_MEM_LIMIT" =~ $regex ]]; then
51
51
warn " Downgrading the CONTAINER_MEM_LIMIT to $(( $num / BYTES_PER_MEG)) m because ${CONTAINER_MEM_LIMIT} will result in a larger heap then recommended."
52
52
fi
53
53
54
+
55
+ # check cgroup version
56
+ info " Inspecting cgroup version..."
57
+ if [ -r " /sys/fs/cgroup/cgroup.controllers" ]; then
58
+ # cgroup v2
59
+ info " Detected cgroup v2"
60
+ mem_file=" /sys/fs/cgroup/memory.max"
61
+ else
62
+ # cgroup v1
63
+ info " Detected cgroup v1"
64
+ mem_file=" /sys/fs/cgroup/memory/memory.limit_in_bytes"
65
+ fi
66
+
54
67
# determine max allowable memory
55
68
info " Inspecting the maximum RAM available..."
56
- mem_file=" /sys/fs/cgroup/memory/memory.limit_in_bytes"
57
69
if [ -r " ${mem_file} " ]; then
58
70
max_mem=" $( cat ${mem_file} ) "
59
71
if [ ${max_mem} -lt ${num} ]; then
You can’t perform that action at this time.
0 commit comments