diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper
index 58eaedc067902896838ad2f082246e9a75234b06..7c50bc106aee6bdcfda70ac3d1750315ed4825c9 100755
--- a/cmake_targets/tools/build_helper
+++ b/cmake_targets/tools/build_helper
@@ -41,7 +41,7 @@ KERNEL_VERSION=$(uname -r | cut -d '.' -f1)
 KERNEL_MAJOR=$(uname -r | cut -d '.' -f2)
 
 #check if we run inside a container
-IS_CONTAINER=`egrep -c "docker|podman|kubepods" /proc/self/cgroup`
+IS_CONTAINER=`egrep -c "docker|podman|kubepods" /proc/self/cgroup || true`
 #sudo is not needed inside a container
 if [ $IS_CONTAINER -eq 0 ]
 then