From 24c5c05308abaffe59f84a403b0d7c27c772700b Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 4 Oct 2024 19:30:57 +0300 Subject: [PATCH] Give friendlier messages when cgroup v2 is not enabled --- api/src/docker-entrypoint.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/api/src/docker-entrypoint.sh b/api/src/docker-entrypoint.sh index 7cf37e3..2a4e49c 100755 --- a/api/src/docker-entrypoint.sh +++ b/api/src/docker-entrypoint.sh @@ -1,5 +1,21 @@ #!/bin/bash +CGROUP_FS="/sys/fs/cgroup" +if [ ! -e "$CGROUP_FS" ]; then + echo "Cannot find $CGROUP_FS. Please make sure your system is using cgroup v2" + exit 1 +fi + +if [ -e "$CGROUP_FS/unified" ]; then + echo "Combined cgroup v1+v2 mode is not supported. Please make sure your system is using pure cgroup v2" + exit 1 +fi + +if [ ! -e "$CGROUP_FS/cgroup.subtree_control" ]; then + echo "Cgroup v2 not found. Please make sure cgroup v2 is enabled on your system" + exit 1 +fi + cd /sys/fs/cgroup && \ mkdir isolate/ && \ echo 1 > isolate/cgroup.procs && \