github.com/m3db/m3@v1.5.1-0.20231129193456-75a402aa583b/docker/sysctl-setter/Dockerfile (about)

     1  FROM alpine:3.11
     2  LABEL maintainer="The M3DB Authors <m3db@googlegroups.com>"
     3  
     4  RUN apk add --no-cache procps && echo $'#!/bin/ash\n\
     5  set -e\n\
     6  while true; do\n\
     7    MVAL=$(sysctl -n vm.max_map_count)\n\
     8    MIN_MVAL=${SYSCTL_VM_MAX_MAP_COUNT:-3000000}\n\
     9    if [ "$MVAL" -lt "$MIN_MVAL" ]; then\n\
    10      sysctl -w vm.max_map_count=${MIN_MVAL}\n\
    11    fi\n\
    12    SVAL=$(sysctl -n vm.swappiness)\n\
    13    if [ "$SVAL" -ne 1 ]; then\n\
    14      sysctl -w vm.swappiness=1\n\
    15    fi\n\
    16    FVAL=$(sysctl -n fs.file-max)\n\
    17    MIN_FVAL=${SYSCTL_FS_FILE_MAX:-3000000}\n\
    18    if [ "$FVAL" -lt "$MIN_FVAL" ]; then\n\
    19      sysctl -w fs.file-max=${MIN_FVAL}\n\
    20    fi\n\
    21    OVAL=$(sysctl -n fs.nr_open)\n\
    22    MIN_OVAL=${SYSCTL_FS_NR_OPEN:-3000000}\n\
    23    if [ "$OVAL" -lt "$MIN_OVAL" ]; then\n\
    24      sysctl -w fs.nr_open=${MIN_OVAL}\n\
    25    fi\n\
    26    sleep 60\n\
    27  done' > /bin/m3dbnode_sysctl.sh &&\
    28    chmod +x /bin/m3dbnode_sysctl.sh
    29  
    30  ENTRYPOINT [ "/bin/m3dbnode_sysctl.sh" ]