update the "Install Netdata with Docker" doc (#14385)
* update packaging/docker/README.md * rebase and make the file GitHub friendly * suggestions from review
Fotis Voutsas committed
Feb 8, 2023 at 15:12 UTC
d7056b4b4f1c88e5c3e211a46d65b07b70c1c08a
1 file changed
+92
-66
packaging/docker/README.md
+92
-66
@@ -8,19 +8,10 @@ learn_topic_type: "Tasks"
8
learn_rel_path: "Installation"
9
-->
10
11
-# Install the Netdata Agent with Docker
11
+import Tabs from '@theme/Tabs';
12
+import TabItem from '@theme/TabItem';
13
13
-Running the Netdata Agent in a container works best for an internal network or to quickly analyze a host. Docker helps
14
-you get set up quickly, and doesn't install anything permanent on the system, which makes uninstalling the Agent easy.
15
-
16
-See our full list of Docker images at [Docker Hub](https://hub.docker.com/r/netdata/netdata).
17
-
18
-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
19
-about the information collected, and learn how to-opt, on our [anonymous statistics](https://github.com/netdata/netdata/blob/master/docs/anonymous-statistics.md)
20
-page.
21
-
22
-The usage statistics are _vital_ for us, as we use them to discover bugs and prioritize new features. We thank you for
23
-_actively_ contributing to Netdata's future.
14
+# Install Netdata with Docker
15
16
## Limitations running the Agent in Docker
17
@@ -41,22 +32,25 @@ and unfortunately not something we can realistically work around.
32
33
## Create a new Netdata Agent container
34
44
-> **Notice**: all `docker run` commands and `docker-compose` configurations explicitly set the `nofile` limit. This is
45
-> required on some distros until [14177](https://github.com/netdata/netdata/issues/14177) is resolved. Failure to do so
46
-> may cause a task running in a container to hang and consume 100% of the CPU core.
47
-
48
-<details>
49
-<summary>What are these "some distros"?</summary>
50
-
51
-If `LimitNOFILE=infinity` results in an open file limit of 1073741816:
52
-
53
-```bash
54
-[fedora37 ~]$ docker run --rm busybox grep open /proc/self/limits
55
-Max open files 1073741816 1073741816 files
56
-```
57
-</details>
58
-
59
-You can create a new Agent container using either `docker run` or Docker Compose. After using either method, you can
35
+> :bookmark_tabs: Note
36
+>
37
+> All `docker run` commands and `docker-compose` configurations explicitly set the `nofile` limit.
38
+> This is required on some distros until [14177](https://github.com/netdata/netdata/issues/14177) is resolved.
39
+> Failure to do so may cause a task running in a container to hang and consume 100% of the CPU core.
40
+>
41
+> <details>
42
+> <summary>What are these "some distros"?</summary>
43
+>
44
+> If `LimitNOFILE=infinity` results in an open file limit of 1073741816:
45
+>
46
+> ```bash
47
+> [fedora37 ~]$ docker run --rm busybox grep open /proc/self/limits
48
+> Max open files 1073741816 1073741816 files
49
+> ```
50
+>
51
+> </details>
52
+
53
+You can create a new Agent container using either `docker run` or `docker-compose`. After using either method, you can
54
visit the Agent dashboard `http://NODE:19999`.
55
56
Both methods create a [bind mount](https://docs.docker.com/storage/bind-mounts/) for Netdata's configuration files
@@ -64,7 +58,12 @@ _within the container_ at `/etc/netdata`. See the [configuration section](#confi
58
you want to access the configuration files from your _host_ machine, see [host-editable
59
configuration](#host-editable-configuration).
60
67
-**`docker run`**: Use the `docker run` command, along with the following options, to start a new container.
61
+<Tabs>
62
+<TabItem value="docker_run" label="docker run">
63
+
64
+<h3> Using the <code>docker run</code> command </h3>
65
+
66
+Run the following command along with the following options on your terminal, to start a new container.
67
68
```bash
69
docker run -d --name=netdata \
@@ -84,44 +83,65 @@ docker run -d --name=netdata \
83
netdata/netdata
84
```
85
87
-**Docker Compose**: Copy the following code and paste into a new file called `docker-compose.yml`, then run
88
-`docker-compose up -d` in the same directory as the `docker-compose.yml` file to start the container.
89
-
90
-```yaml
91
-version: '3'
92
-services:
93
- netdata:
94
- image: netdata/netdata
95
- container_name: netdata
96
- hostname: example.com # set to fqdn of host
97
- ports:
98
- - 19999:19999
99
- restart: unless-stopped
100
- cap_add:
101
- - SYS_PTRACE
102
- security_opt:
103
- - apparmor:unconfined
104
- ulimits:
105
- nofile:
106
- soft: 4096
107
- volumes:
108
- - netdataconfig:/etc/netdata
109
- - netdatalib:/var/lib/netdata
110
- - netdatacache:/var/cache/netdata
111
- - /etc/passwd:/host/etc/passwd:ro
112
- - /etc/group:/host/etc/group:ro
113
- - /proc:/host/proc:ro
114
- - /sys:/host/sys:ro
115
- - /etc/os-release:/host/etc/os-release:ro
116
-
117
-volumes:
118
- netdataconfig:
119
- netdatalib:
120
- netdatacache:
121
-```
86
+> :bookmark_tabs: Note
87
+>
88
+> If you plan to Claim the node to Netdata Cloud, you can find the command with the right parameters by clicking the "Add Nodes" button in your Space's "Nodes" view.
89
+
90
+</TabItem>
91
+<TabItem value="docker compose" label="docker-compose">
92
+
93
+<h3> Using the <code>docker-compose</code> command</h3>
94
+
95
+#### Steps
96
+
97
+1. Copy the following code and paste into a new file called `docker-compose.yml`
98
+
99
+ ```yaml
100
+ version: '3'
101
+ services:
102
+ netdata:
103
+ image: netdata/netdata
104
+ container_name: netdata
105
+ hostname: example.com # set to fqdn of host
106
+ ports:
107
+ - 19999:19999
108
+ restart: unless-stopped
109
+ cap_add:
110
+ - SYS_PTRACE
111
+ security_opt:
112
+ - apparmor:unconfined
113
+ ulimits:
114
+ nofile:
115
+ soft: 4096
116
+ volumes:
117
+ - netdataconfig:/etc/netdata
118
+ - netdatalib:/var/lib/netdata
119
+ - netdatacache:/var/cache/netdata
120
+ - /etc/passwd:/host/etc/passwd:ro
121
+ - /etc/group:/host/etc/group:ro
122
+ - /proc:/host/proc:ro
123
+ - /sys:/host/sys:ro
124
+ - /etc/os-release:/host/etc/os-release:ro
125
+
126
+ volumes:
127
+ netdataconfig:
128
+ netdatalib:
129
+ netdatacache:
130
+ ```
131
+
132
+2. Run `docker-compose up -d` in the same directory as the `docker-compose.yml` file to start the container.
133
+
134
+> :bookmark_tabs: Note
135
+>
136
+> If you plan to Claim the node to Netdata Cloud, you can find the command with the right parameters by clicking the "Add Nodes" button in your Space's "Nodes" view.
137
+
138
+</TabItem>
139
+</Tabs>
140
141
## Docker tags
142
143
+See our full list of Docker images at [Docker Hub](https://hub.docker.com/r/netdata/netdata).
144
+
145
The official `netdata/netdata` Docker image provides the following named tags:
146
147
* `stable`: The `stable` tag will always point to the most recently published stable build.
@@ -176,7 +196,9 @@ to restart the container: `docker restart netdata`.
196
197
### Host-editable configuration
198
179
-> **Warning**: [edit-config](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory) script doesn't work when executed on
199
+> :warning: Warning
200
+>
201
+> The [edit-config](https://github.com/netdata/netdata/blob/master/docs/configure/nodes.md#the-netdata-config-directory) script doesn't work when executed on
202
> the host system.
203
204
If you want to make your container's configuration directory accessible from the host system, you need to use a
@@ -356,8 +378,10 @@ services:
378
379
#### Giving group access to the Docker socket (less safe)
380
381
+> :warning: Caution
382
+>
383
> You should seriously consider the necessity of activating this option, as it grants to the `netdata`
360
-user access to the privileged socket connection of docker service and therefore your whole machine.
384
+> user access to the privileged socket connection of docker service and therefore your whole machine.
385
386
If you want to have your container names resolved by Netdata, make the `netdata` user be part of the group that owns the
387
socket.
@@ -386,6 +410,8 @@ grep docker /etc/group | cut -d ':' -f 3
410
411
#### Running as root (unsafe)
412
413
+> :warning: Caution
414
+>
415
> You should seriously consider the necessity of activating this option, as it grants to the `netdata` user access to
416
> the privileged socket connection of docker service, and therefore your whole machine.
417