Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

302
Views
docker container increase listen queue size beyond 128

How can I increase the listen queue size beyond 128 on a docker image with a read only file system?

When I run my container I get the following error:

uWSGI: - Listen queue size is greater than the system max net.core.somaxconn (128).

I have a Dockerfile with base image python:2.7. I am trying to increase system level limit on Unix socket and TCP connection listen queue so that uwsgi can set a listen queue limit of 1024, as described at uwsgi: your server socket listen backlog is limited to 100 connections.

I tried adding these RUN commands to the Dockerfile:

  • echo 4096 > /proc/sys/net/core/somaxconn
  • sysctl -w net.core.somaxconn=4096

But these both fail with the following errors respectively:

  • /bin/sh: 1: cannot create /proc/sys/net/core/somaxconn: Read-only file system
  • sysctl: setting key "net.core.somaxconn": Read-only file system

I also tried mounting a file to overwrite the /proc/sys/net/core/somaxconn and that failed with the error cannot be mounted because it is located inside "/proc"

I also tried running sudo sysctl -w net.core.somaxconn=4096 net.core.somaxconn = 4096 on the host before running, but it isn't reflected in the docker container; uwsgi still fails with the error uWSGI: - Listen queue size is greater than the system max net.core.somaxconn (128) and running cat /proc/sys/net/core/somaxconn shows 128 in the container while showing 4096 on the host.

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

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

about 4 years ago · Santiago Trujillo Report

0

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

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!