Influxdb containers
From wikinotes
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/influxdb2sudo 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 access influxdb using any of:
# Web UI # user: user # pass: password open 'http://localhost:8086'# CLI sudo podman exec -ti ${image} /bin/bash influx ping # test connection# HTTP API curl 'http://localhost:8086/api/v2' \ --header 'Authorization: Token token' \ --header 'Content-Type: application/json' \ --data-urlencode "db=default" \ --data-urlencode "q=SELECT * FROM cpu_usage" \ | jq