Tuukka Mustonen Tuukka Mustonen - 1 year ago 223
Linux Question

Refresh net.core.somaxcomm (or any sysctl property) for docker containers

I am trying to change

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
$ sudo sysctl -w net.core.somaxconn=1024
net.core.somaxconn = 1024
$ cat /proc/sys/net/core/somaxconn

But then I don't know how to propagate that change into docker. I've tried:

  • Also editing
    (in hope of docker reading that file on container launch)

  • Restarting containers
    sudo docker stop
    sudo docker run

  • Restarting the whole docker service by
    sudo service docker restart

But inside container,
cat /proc/sys/net/core/somaxconn
always shows

I'm running docker 1.2 (so I cannot, by default, modify
attributes inside container) and in Elastic Beanstalk (so without
mode, that would allow me to modify

How can I propagate the sysctl changes to docker?

Answer Source

Just figured out how to solve this, now Elastic Beanstalk supports running a privileged containers and you just need to add the "privileged": "true" to your Dockerrun.aws.json as the following sample (please take a look at the container-1):

  "AWSEBDockerrunVersion": 2,
  "containerDefinitions": [{
    "name": "container-0",
    "essential": "false",
    "image": "ubuntu",
    "memory": "512"
  }, {
    "name": "container-1",
    "essential": "false",
    "image": "ubuntu",
    "memory": "512",
    "privileged": "true"

Please note that I duplicated this answer from another thread.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download