I am trying to change net.core.somaxconn
for docker container to be able to have larger queue of requests for my web application.
On OS, outside docker, I first modify the property successfully:
$ cat /proc/sys/net/core/somaxconn
128
$ sudo sysctl -w net.core.somaxconn=1024
net.core.somaxconn = 1024
$ cat /proc/sys/net/core/somaxconn
1024
But then I don't know how to propagate that change into docker. I've tried:
- Also editing
/etc/sysctl.conf
(in hope of docker reading that file on container launch)
- Restarting containers
sudo docker stop
and sudo docker run
again
- Restarting the whole docker service by
sudo service docker restart
But inside container, cat /proc/sys/net/core/somaxconn
always shows 128
.
I'm running docker 1.2 (so I cannot, by default, modify /proc
attributes inside container) and in Elastic Beanstalk (so without --privileged
mode, that would allow me to modify /proc
).
How can I propagate the sysctl changes to docker?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…