docs: add a note about network interface monitoring when running in a Docker container (#13458)
Ilya Mashchenko committed
Jul 29, 2022 at 23:16 UTC
e2be6f942a409150a0e5b50e9db55ec559846a96
1 file changed
+45
-9
packaging/docker/README.md
+45
-9
@@ -11,7 +11,7 @@ you get set up quickly, and doesn't install anything permanent on the system, wh
11
12
See our full list of Docker images at [Docker Hub](https://hub.docker.com/r/netdata/netdata).
13
14
-Starting with v1.30, Netdata collects anonymous usage information by default and sends it to a self hosted PostHog instance within the Netdata infrastructure. Read
14
+Starting with v1.30, Netdata collects anonymous usage information by default and sends it to a self-hosted PostHog instance within the Netdata infrastructure. Read
15
about the information collected, and learn how to-opt, on our [anonymous statistics](/docs/anonymous-statistics.md)
16
page.
17
@@ -133,12 +133,12 @@ You can control how the health checks run by using the environment variable `NET
133
134
In most cases, the default behavior of checking the `/api/v1/info`
135
endpoint will be sufficient. If you are using a configuration which
136
-disables the web server or restricts access to certain API's, you will
136
+disables the web server or restricts access to certain APIs, you will
137
need to use a non-default configuration for health checks to work.
138
139
## Configure Agent containers
140
141
-If you started an Agent container using one of the [recommended methods](#create-a-new-netdata-agent-container) and you
141
+If you started an Agent container using one of the [recommended methods](#create-a-new-netdata-agent-container), and you
142
want to edit Netdata's configuration, you must first use `docker exec` to attach to the container. Replace `netdata`
143
with the name of your container.
144
@@ -222,7 +222,7 @@ volumes:
222
223
You can change the hostname of a Docker container, and thus the name that appears in the local dashboard and in Netdata
224
Cloud, when creating a new container. If you want to change the hostname of a Netdata container _after_ you started it,
225
-you can safely stop and remove it. You configuration and metrics data reside in persistent volumes and are reattached to
225
+you can safely stop and remove it. Your configuration and metrics data reside in persistent volumes and are reattached to
226
the recreated container.
227
228
If you use `docker-run`, use the `--hostname` option with `docker run`.
@@ -251,7 +251,7 @@ how you created the container.
251
252
### Add or remove other volumes
253
254
-Some of the volumes are optional depending on how you use Netdata:
254
+Some volumes are optional depending on how you use Netdata:
255
256
- If you don't want to use the apps.plugin functionality, you can remove the mounts of `/etc/passwd` and `/etc/group`
257
(they are used to get proper user and group names for the monitored host) to get slightly better security.
@@ -367,6 +367,42 @@ services:
367
- DOCKER_USR=root
368
```
369
370
+### Docker container network interfaces monitoring
371
+
372
+Netdata can map a virtual interface in the system namespace to an interface inside a Docker container
373
+when using network [bridge](https://docs.docker.com/network/bridge/) driver. To do this, the Netdata container needs
374
+additional privileges:
375
+
376
+- the host PID mode. This turns on sharing between container and the host operating system the PID
377
+ address space (needed to get list of PIDs from `cgroup.procs` file).
378
+
379
+- `SYS_ADMIN` capability (needed to execute `setns()`).
380
+
381
+**docker run**:
382
+
383
+```bash
384
+docker run -d --name=netdata \
385
+ ...
386
+ --pid=host \
387
+ --cap-add SYS_ADMIN \
388
+ ...
389
+ netdata/netdata
390
+```
391
+
392
+**docker compose**:
393
+
394
+```yaml
395
+version: '3'
396
+services:
397
+ netdata:
398
+ image: netdata/netdata
399
+ container_name: netdata
400
+ pid: host
401
+ cap_add:
402
+ - SYS_ADMIN
403
+ ...
404
+```
405
+
406
### Pass command line options to Netdata
407
408
Since we use an [ENTRYPOINT](https://docs.docker.com/engine/reference/builder/#entrypoint) directive, you can provide
@@ -384,7 +420,7 @@ email address for [Let's Encrypt](https://letsencrypt.org/) before starting.
420
421
### Caddyfile
422
387
-This file needs to be placed in `/opt` with name `Caddyfile`. Here you customize your domain and you need to provide
423
+This file needs to be placed in `/opt` with name `Caddyfile`. Here you customize your domain, and you need to provide
424
your email address to obtain a Let's Encrypt certificate. Certificate renewal will happen automatically and will be
425
executed internally by the caddy server.
426
@@ -450,10 +486,10 @@ You may either use the command line tools available or take advantage of our Tra
486
487
### Inside Netdata organization, using Travis CI
488
453
-To enable Travis CI integration on your own repositories (Docker and Github), you need to be part of the Netdata
489
+To enable Travis CI integration on your own repositories (Docker and GitHub), you need to be part of the Netdata
490
organization.
491
456
-Once you have contacted the Netdata owners to setup you up on Github and Travis, execute the following steps
492
+Once you have contacted the Netdata owners to setup you up on GitHub and Travis, execute the following steps
493
494
- Preparation
495
- Have Netdata forked on your personal GitHub account
@@ -478,7 +514,7 @@ Once you have contacted the Netdata owners to setup you up on Github and Travis,
514
515
- While in Travis settings, under Netdata repository settings in the Environment Variables section, you need to add
516
the following:
481
- - `DOCKER_USERNAME` and `DOCKER_PWD` variables so that Travis can login to your Docker Hub account and publish
517
+ - `DOCKER_USERNAME` and `DOCKER_PWD` variables so that Travis can log in to your Docker Hub account and publish
518
Docker images there.
519
- `REPOSITORY` variable to `NETDATA_DEVELOPER/netdata`, where `NETDATA_DEVELOPER` is your GitHub handle again.
520
- `GITHUB_TOKEN` variable with the token generated on the preparation step, for Travis workflows to function