@cryptotaxi247 / netdata-1 / commits / dee7d4756

Add documentation for configuring/editing hostnames of Docker-run Agents (#10087)

* Add doc for Docker hostname * Small tweak * Remove extra w

Joel Hans committed Oct 26, 2020 at 10:54 UTC dee7d475695c442acb2328c1fce4a1291cac44ce
1 file changed +34 -3
packaging/docker/README.md
+34 -3
@@ -119,9 +119,9 @@ need to use a non-default configuration for health checks to work.
119
120 ## Configure Agent containers
121
122 -If you started an Agent container using one of the [recommended methods](#create-a-new-netdata-agent-container), you
123 -must first use `docker exec` to attach to the container. Replace `netdata` with the name of your Agent container in the
124 -first command below.
122 +If you started an Agent container using one of the [recommended methods](#create-a-new-netdata-agent-container) and you
123 +want to edit Netdata's configuration, you must first use `docker exec` to attach to the container. Replace `netdata`
124 +with the name of your container.
125
126 ```bash
127 docker exec -it netdata bash
@@ -199,6 +199,37 @@ volumes:
199 netdatacache:
200 ```
201
202 +### Change the default hostname
203 +
204 +You can change the hostname of a Docker container, and thus the name that appears in the local dashboard and in Netdata
205 +Cloud, when creating a new container. If you want to change the hostname of a Netdata container _after_ you started it,
206 +you can safely stop and remove it. You configuration and metrics data reside in persistent volumes and are reattached to
207 +the recreated container.
208 +
209 +If you use `docker-run`, use the `--hostname` option with `docker run`.
210 +
211 +```bash
212 +docker run -d --name=netdata \
213 + --hostname=my_docker_netdata
214 +```
215 +
216 +If you use `docker-compose`, add a `hostname:` key/value pair into your `docker-compose.yml` file, then create the
217 +container again using `docker-compose up -d`.
218 +
219 +```yaml
220 +version: '3'
221 +services:
222 + netdata:
223 + image: netdata/netdata
224 + container_name: netdata
225 + hostname: my_docker_compose_netdata
226 + ...
227 +```
228 +
229 +If you don't want to destroy and recreate your container, you can edit the Agent's `netdata.conf` file directly. See the
230 +above section on [configuring Agent containers](#configure-agent-containers) to find the appropriate method based on
231 +how you created the container.
232 +
233 ### Add or remove other volumes
234
235 Some of the volumes are optional depending on how you use Netdata: