From 77ff9d6f659c77a81d99f49b45401d874d8f236a Mon Sep 17 00:00:00 2001 From: pierwill <19642016+pierwill@users.noreply.github.com> Date: Fri, 26 Feb 2021 12:30:46 -0800 Subject: [PATCH] Document using a config file through Docker volume (#2207) Document using InfluxDB config file with Docker volume Replace quay image with DockerHub Co-authored-by: Scott Anderson --- content/influxdb/v2.0/get-started.md | 36 ++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/content/influxdb/v2.0/get-started.md b/content/influxdb/v2.0/get-started.md index 0bf049567..20ffccef0 100644 --- a/content/influxdb/v2.0/get-started.md +++ b/content/influxdb/v2.0/get-started.md @@ -311,7 +311,7 @@ Expose port `8086`, which InfluxDB uses for client-server communication over the [InfluxDB HTTP API](/influxdb/v2.0/reference/api/). ```sh -docker run --name influxdb -p 8086:8086 quay.io/influxdb/influxdb:v2.0.4 +docker run --name influxdb -p 8086:8086 influxdb:2.0.4 ``` _To run InfluxDB in [detached mode](https://docs.docker.com/engine/reference/run/#detached-vs-foreground), include the `-d` flag in the `docker run` command._ @@ -331,14 +331,40 @@ _To run InfluxDB in [detached mode](https://docs.docker.com/engine/reference/run --name influxdb \ -p 8086:8086 \ --volume $PWD:/root/.influxdbv2 \ - quay.io/influxdb/influxdb:v2.0.4 + influxdb:2.0.4 ``` +### Configure InfluxDB with Docker + +To mount an InfluxDB configuration file and use it from within Docker: + +1. [Persist data outside the InfluxDB container](#persist-data-outside-the-influxdb-container). + +2. Use the command below to generate the default configuration file on the host file system: + + ```sh + $ docker run \ + --rm influxdb:2.0.4 \ + influxd print-config > config.yml + ``` + +3. Modify the default configuration, which will now be available under `$PWD`. + +4. Start the InfluxDB container: + + ```sh + $ docker run -p 8086:8086 \ + -v $PWD/config.yml:/etc/influxdb2/config.yml:ro \ + influxdb:2.0.4 + ``` + +(Find more about configuring InfluxDB [here](https://docs.influxdata.com/influxdb/v2.0/reference/config-options/).) + ### Console into the InfluxDB container To use the `influx` command line interface, console into the `influxdb` Docker container: -```bash +```sh docker exec -it influxdb /bin/bash ``` @@ -352,8 +378,8 @@ information about what data is collected and how it is used. To opt-out of sending telemetry data back to InfluxData, include the `--reporting-disabled` flag when starting the InfluxDB container. -```bash -docker run -p 8086:8086 quay.io/influxdb/influxdb:v2.0.4 --reporting-disabled +```sh +docker run -p 8086:8086 influxdb:2.0.4 --reporting-disabled ``` {{% /note %}}