From 20c6b515ed087ff94ef77f2bfdc207c7a2cdec7a Mon Sep 17 00:00:00 2001 From: "Josh.5" Date: Sun, 17 Sep 2023 15:54:43 +1200 Subject: [PATCH] Ignore setting max_map_count when container is run unprivileged --- overlay/etc/cont-init.d/11-setup_sysctl_values.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/overlay/etc/cont-init.d/11-setup_sysctl_values.sh b/overlay/etc/cont-init.d/11-setup_sysctl_values.sh index dd79db5..ae3e42e 100644 --- a/overlay/etc/cont-init.d/11-setup_sysctl_values.sh +++ b/overlay/etc/cont-init.d/11-setup_sysctl_values.sh @@ -13,8 +13,14 @@ echo "**** Configure some system kernel parameters ****" if [ "$(cat /proc/sys/vm/max_map_count)" -ge 524288 ]; then - echo "Setting the maximum number of memory map areas a process can create to 524288" - echo 524288 > /proc/sys/vm/max_map_count + if [ -w "/proc/sys/vm/max_map_count" ]; then + echo "Setting the maximum number of memory map areas a process can create to 524288" + echo 524288 > /proc/sys/vm/max_map_count + else + echo "WARNING: Unable to set max_map_count on unprivileged container" + fi +else + echo "NOTE: vm.max_map_count is already greater than '524288'" fi echo "DONE"