docker container increase listen queue size beyond 128

If you prefer using docker-compose. Here's the configuration that you want to adjust:

sysctls:
  net.core.somaxconn: 1024

Or

sysctls:
  - net.core.somaxconn=1024

Reference: https://github.com/compose-spec/compose-spec/blob/master/spec.md#sysctls


You either need to run Docker in privileged mode than you can modify the /proc file system after the container was started or you upgrade to a newer Docker release. run subcommand has the --sysctl option, which allows to make the change you envision:

$ docker run -ti --sysctl net.core.somaxconn=4096 --rm ubuntu /bin/bash root@9e850908ddb7:/# sysctl net.core.somaxconn net.core.somaxconn = 4096