[Solved] Redis: TCP backlog setting of 511 cannot be enforced

While installing Redis via docker, if you get following error:

WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

You can easily fix it, by uninstalling and reinstalling with following commands. Also, increasing the value in your server.
$ sysctl -w net.core.somaxconn=65535; sysctl -p
$ docker container rm CONTAINER-ID
$ docker rmi IMAGE
$ docker run -d --name redis --sysctl net.core.somaxconn=511 -p 6379:6379 --restart unless-stopped -v /etc/redis/:/data redis redis-server /data --appendonly yes --requirepass “YOUR-PASSWORD”

Finally check the logs, and Voila! error will be gone.

$ docker logs CONTAINER-ID
1:C 04 Jul 2020 20:48:39.059 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 04 Jul 2020 20:48:39.059 # Redis version=6.0.5, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 04 Jul 2020 20:48:39.059 # Configuration loaded
1:M 04 Jul 2020 20:48:39.061 * Running mode=standalone, port=6379.
1:M 04 Jul 2020 20:48:39.061 # Server initialized
1:M 04 Jul 2020 20:48:39.063 * Ready to accept connections