Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker Redis container getting WARNING: /proc/sys/net/core/somaxconn in a user defined network

Tags:

docker

redis

Hey guys I'm having a really hard time with this one and I need help. I need to run a Redis container on a user defined network and assign it a static ip so I have this: docker run -v /root/test/:/data/ -p 7001:7001 --net iso_nw --ip 172.18.0.2 --name testy -d redis redis-server /data/redis.conf This causes my Redis instance to display the TCP backlog warning:

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

My brain is fried trying to make this warning go away without using --net host. Can someone help me please. Thanks.

like image 462
jrsanz1 Avatar asked Sep 03 '25 01:09

jrsanz1


2 Answers

You can use docker-compose to do this

version: '3.8'
services:
  redis:
    container_name: redis
    image: redis
    command: ["redis-server", "--appendonly", "yes"]
    sysctls:
      - net.core.somaxconn=65535
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /data/redis:/data
    ports:
      - "6379:6379"
    restart: always

volumes:
  redis-data:
    driver: local

then run docker-compose up -d

like image 78
xirehat Avatar answered Sep 06 '25 18:09

xirehat


Latest version of docker now has --sysctl command available so this should do it:

docker run --name myredis --sysctl net.core.somaxconn=511 -d redis
like image 22
jrsanz1 Avatar answered Sep 06 '25 17:09

jrsanz1