@cryptotaxi247 / netdata-1 / commits / 2ff572a1a

docs: explicitly set the `nofile` limit for Netdata container and document the reason for this (#14178)

Ilya Mashchenko committed Dec 22, 2022 at 22:43 UTC 2ff572a1ad55b3220897b6fdca63c65eb3c92381
1 file changed +21 -22
packaging/docker/README.md
+21 -22
@@ -37,31 +37,19 @@ and unfortunately not something we can realistically work around.
37
38 ## Create a new Netdata Agent container
39
40 +> **Notice**: all `docker run` commands and `docker-compose` configurations explicitly set the `nofile` limit. This is
41 +> required on some distros until [14177](https://github.com/netdata/netdata/issues/14177) is resolved. Failure to do so
42 +> may cause a task running in a container to hang and consume 100% of the CPU core.
43 +
44 <details>
41 -<summary>Prerequisite steps for Fedora users</summary>
42 -
43 -There is a known issue with [Docker Engine on Fedora](https://docs.docker.com/engine/install/fedora/) where a task
44 -running in a container hangs and consumes 100% of the CPU core. The issue is not Netdata specific. When setting
45 -the `nofile` ulimit, the task performs normally.
46 -
47 -To fix the issue, add the following to the `/etc/docker/daemon.json` file and restart `docker.service`:
48 -
49 -```json
50 -{
51 - "default-ulimits": {
52 - "nofile": {
53 - "Hard": 4096,
54 - "Name": "nofile",
55 - "Soft": 4096
56 - }
57 - }
58 -}
59 -```
45 +<summary>What are these "some distros"?</summary>
46
61 -An alternative solution is to set ulimit `nofile` when creating a Netdata container
62 -with [docker run](https://docs.docker.com/engine/reference/commandline/run/#set-ulimits-in-container---ulimit)
63 -or [docker-compose](https://docs.docker.com/compose/compose-file/compose-file-v3/#ulimits).
47 +If `LimitNOFILE=infinity` results in an open file limit of 1073741816:
48
49 +```bash
50 +[fedora37 ~]$ docker run --rm busybox grep open /proc/self/limits
51 +Max open files 1073741816 1073741816 files
52 +```
53 </details>
54
55 You can create a new Agent container using either `docker run` or Docker Compose. After using either method, you can
@@ -88,6 +76,7 @@ docker run -d --name=netdata \
76 --restart unless-stopped \
77 --cap-add SYS_PTRACE \
78 --security-opt apparmor=unconfined \
79 + --ulimit nofile=4096 \
80 netdata/netdata
81 ```
82
@@ -108,6 +97,9 @@ services:
97 - SYS_PTRACE
98 security_opt:
99 - apparmor:unconfined
100 + ulimits:
101 + nofile:
102 + soft: 4096
103 volumes:
104 - netdataconfig:/etc/netdata
105 - netdatalib:/var/lib/netdata
@@ -212,6 +204,7 @@ docker run -d --name=netdata \
204 --restart unless-stopped \
205 --cap-add SYS_PTRACE \
206 --security-opt apparmor=unconfined \
207 + --ulimit nofile=4096 \
208 netdata/netdata
209 ```
210
@@ -233,6 +226,9 @@ services:
226 - SYS_PTRACE
227 security_opt:
228 - apparmor:unconfined
229 + ulimits:
230 + nofile:
231 + soft: 4096
232 volumes:
233 - ./netdataconfig/netdata:/etc/netdata:ro
234 - netdatalib:/var/lib/netdata
@@ -495,6 +491,9 @@ services:
491 - SYS_PTRACE
492 security_opt:
493 - apparmor:unconfined
494 + ulimits:
495 + nofile:
496 + soft: 4096
497 volumes:
498 - netdatalib:/var/lib/netdata
499 - netdatacache:/var/cache/netdata