Is it possible to configure influxdb 2.x user (and get token) without using cli/web ui

Hi thanks for your reply. I was not able to find the pr you meant but I found Influx v2 - telegraf configuration on docker - #3 by Anaisdg which gave me idea to use separate container for influx-cli for setup

Container I added to my compose:

  influxdb:
    # From influxdb docs https://docs.influxdata.com/influxdb/v2.0/get-started/#download-and-run-influxdb-v2-0
    image: influxdb:2.0.4
    restart: unless-stopped
    container_name: influxdb
    networks: 
    - database
    ports:
      - "8086:8086"
    volumes:
      - ../influx/influxdb2:/var/lib/influxdb2
    command: influxd run --reporting-disabled
  influx-cli:
    #  initializes influxdb user/password/bucket...
    image: influxdb:2.0.4
    container_name: influx-cli
    networks: 
    - database
    depends_on:
      - influxdb
    command: sh -c 'sleep 5; influx setup --bucket "${INFLUX_DATA_BUCKET}" --token "${INFLUXDB_V2_TOKEN}" --org "${INFLUXDB_V2_ORG}" --username=${INFLUX_USERNAME} --password=${INFLUX_PASSWORD} --host=http://influxdb:8086 --force'
2 Likes