What is the correct way to resolve warnings when starting Redis when using Docker?

When I launch a Redis Docker image, I come across these warnings:

# Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf ( ... ) # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. ( ... ) # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled. 

Among the solutions that I found on the Internet, this one covers everything, but when I try to use it in the Docker area (for example: changing the Docker file to use them), I get a "Read-only file system" error. A manual example gives me the same problems:

 [ root@769368ed0fc5 /]# sysctl -w net.core.somaxconn=65535 sysctl: setting key "net.core.somaxconn": Read-only file system [ root@769368ed0fc5 /]# echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf [ root@769368ed0fc5 /]# sysctl vm.overcommit_memory=1 sysctl: setting key "vm.overcommit_memory": Read-only file system [ root@769368ed0fc5 /]# echo never > /sys/kernel/mm/transparent_hugepage/enabled bash: /sys/kernel/mm/transparent_hugepage/enabled: Read-only file system [ root@769368ed0fc5 /]# echo never > /sys/kernel/mm/transparent_hugepage/enabled bash: /sys/kernel/mm/transparent_hugepage/enabled: Read-only file system 

Does anyone know how to fix it correctly ? I found many tricks to trick him, for example:

  • Starting container in privileged mode
  • Install host / proc inside container
  • Use network stack (--net = host)

I want to know what is the correct way to handle this in Docker. Responses that provide a technical explanation of the proposed solution will be appreciated.

+6
source share

Source: https://habr.com/ru/post/1012896/


All Articles