Influxdb containers

From wikinotes
Revision as of 17:00, 10 June 2023 by Will (talk | contribs) (→‎Usage)

Docker/Podman

Documentation

dockerhub https://hub.docker.com/_/influxdb/

Usage

TODO:

work in progress. 8086 isn't being exposed to host, needs investigation

Containerfile


FROM docker.io/library/influxdb:2.7
ENV   DOCKER_INFLUXDB_INIT_MODE          setup
ENV   DOCKER_INFLUXDB_INIT_USERNAME      user
ENV   DOCKER_INFLUXDB_INIT_PASSWORD      password
ENV   DOCKER_INFLUXDB_INIT_ORG           org
ENV   DOCKER_INFLUXDB_INIT_BUCKET        bucket
ENV   DOCKER_INFLUXDB_INIT_ADMIN_TOKEN   token
EXPOSE 8086 8086
VOLUME ./data /var/lib/influxdb2
sudo podman build . -t influxdb
sudo podman run localhost/influxdb


adhoc/cli usage


sudo podman pull docker.io/library/influxdb:latest
mkdir {data,config}
sudo podman run --rm 'influxdb:2.7' influx config  --json > config/config.json
docker run \
      -p 8086:8086 \
      -v $PWD/data:/var/lib/influxdb2 \
      -v $PWD/config:/etc/influxdb2 \
      `# setup authentication` \
      -e DOCKER_INFLUXDB_INIT_MODE=setup \
      -e DOCKER_INFLUXDB_INIT_USERNAME=my-user \
      -e DOCKER_INFLUXDB_INIT_PASSWORD=my-password \
      -e DOCKER_INFLUXDB_INIT_ORG=my-org \
      -e DOCKER_INFLUXDB_INIT_BUCKET=my-bucket \
      -e DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-super-secret-auth-token \
      influxdb:latest


Then either:

  • login to UI at http://localhost:8086 with user=my-user and password=my-password.
  • podman exec -ti ${image} /bin/bash then run influx ping to confirm reachable