# How do you set net.core.somaxconn in the docker container?

**URL:** https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577
**Category:** Self-hosting
**Created:** [June 15, 2017, 9:29pm UTC](https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577 "2017-06-15T21:29:34Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![squidboylan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/squidboylan/32/120930_2.png) [@squidboylan](https://meta.discourse.org/u/squidboylan)
#### Post date: [June 15, 2017, 9:29pm UTC](https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577/1 "2017-06-15T21:29:34Z")

</div>

How do you set net.core.somaxconn in the docker container so that Redis doesn’t complain that somaxconn is less than 511? Using sysctl doesnt work inside of the container and setting it on the host doesn’t affect the container. Perhaps the launcher script should know to run docker with the `--sysctl net.core.somaxconn=512` option?

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [June 16, 2017, 1:27am UTC](https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577/2 "2017-06-16T01:27:21Z")

</div>

[![](https://global.discourse-cdn.com/meta/original/4X/b/e/0/be0e20248c18d83bb50f67b4de548c6e4488518e.jpeg "Simpsons check engine light") ](https://www.youtube.com/watch?v=I13ebtK3sSQ)

---

<div class="post-metadata">

### Author: ![smaffulli](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/smaffulli/32/120462_2.png) [@smaffulli](https://meta.discourse.org/u/smaffulli)
#### Post date: [June 16, 2017, 4:33pm UTC](https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577/3 "2017-06-16T16:33:59Z")

</div>

What’s that supposed to mean: that ignoring the warning will blow up your site? Or that the warning is a joke?

PS Sarcasm doesn’t transfer over TCP/IP 🙂

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [June 16, 2017, 10:45pm UTC](https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577/4 "2017-06-16T22:45:43Z")

</div>

Can we ever _truly_ know what _anything_ means, really?

What I meant was that you can ignore the warning, it’s just Redis being finicky.

---

<div class="post-metadata">

### Author: ![dmitry\_fedyuk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_fedyuk/32/293153_2.png) [@dmitry\_fedyuk](https://meta.discourse.org/u/dmitry_fedyuk)
#### Post date: [January 23, 2018, 6:41pm UTC](https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577/5 "2018-01-23T18:41:33Z")

</div>

I have found the solution:

```plaintext
./launcher rebuild <container> --docker-args "--sysctl net.core.somaxconn=65535"

```

> <https://github.com/discourse/discourse_docker/blob/e9505520/launcher#L18-L18>

«[docker run](https://docs.docker.com/engine/reference/commandline/run/)» → «[Configure namespaced kernel parameters (sysctls) at runtime](https://docs.docker.com/engine/reference/commandline/run/#configure-namespaced-kernel-parameters-sysctls-at-runtime)»

![02](https://global.discourse-cdn.com/meta/original/3X/4/c/4c2450a6660e937da9185d777a152c2cfa922cb1.png)

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [November 12, 2018, 9:51am UTC](https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577/7 "2018-11-12T09:51:59Z")

</div>

I noticed the following warning in my rebuild log:

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

I was doing some reading and [found some suggestions to raise this value](https://www.techandme.se/performance-tips-for-redis-cache-server/). Should I? Will this help performance of our platform?

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [November 12, 2018, 11:32am UTC](https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577/8 "2018-11-12T11:32:12Z")

</div>

Thanks for moving my post to the right topic guys, it was kinda hard to find as the keyword appears in many search results 🖖

So there’s no apparent advantage to tweaking this value? That’s one thing off my todo list then!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [August 29, 2021, 2:51am UTC](https://meta.discourse.org/t/how-do-you-set-net-core-somaxconn-in-the-docker-container/64577/9 "2021-08-29T02:51:10Z")

</div>


