No Admin user created with INFLUXDB_ADMIN_USER with dockered influxdb 1.8.10

I am a novice in more than one respect and I am trying to copy my ‘openhab+influxdb+grafana’ environment from a RPi4 into a headless NUC .
Found some links on the internet that helps me with this process.
Openhab and restoring its backup went flawlessly (as far I can see).

With Influxdb 1.8.10 I am struggeling with my users. I expect that for example that ‘INFLUXDB_ADMIN_USER’ will create an influx admin user which is visible with:

nuc@nuc:/opt/openhab$ docker exec -it influxdb18 /bin/sh
# influx
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> show users
user  admin

But it wasn’t.
BTW no problem to create it manually with:

CREATE USER admin WITH PASSWORD ‘adminpass’ WITH ALL PRIVILEGES

So my question is why did my docker-influx command not create an admin user?
Are my expectations incorrect?
(below simplified docker-influx version did not do the expected thing also).

docker run -p 8091:8091 \
-e INFLUXDB_ADMIN_USER=admin \
-e INFLUXDB_ADMIN_PASSWORD=adminpass \
-v influxdb:/var/lib/influxdb \
influxdb:1.8

Have tried to add and play with:

INFLUXDB_HTTP_AUTH_ENABLED=false
INFLUXDB_ADMIN_ENABLED=true

But that did not make a difference
Your comments to put me on the right track would be appreciated.

Some details:
NUC7i3BNK 12Gb Ubuntu server Ubuntu 22.04.1 LTS
Docker version:

nuc@nuc:/opt/openhab$ docker version
Client: Docker Engine - Community
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:01:58 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 17:59:49 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.9
  GitCommit:        1c90a442489720eec95342e1789ee8a5e1b9536f
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

Seems that some examples did not care to much about authentication and authorization.
The example of Joshua Powers put me on a better track:

docker run --tty -d –net host
–env INFLUXDB_HTTP_AUTH_ENABLED=“true”
–env INFLUXDB_DB=“testing”
–env INFLUXDB_ADMIN_USER=“admin”
–env INFLUXDB_ADMIN_PASSWORD=“adminpass”
-v influxdb:/var/lib/influxdb
–name influxdb18
influxdb:1.8

“confusion is my epitaph”

@WJ4IoT,
thanks for sharing your solution.
Out of curiosity why are you using 1.x instead of 2.x as a new user?
Thank you :slight_smile:

@Anaisdg, I am not completely new with Influxdb; at the moment a RPi4 is running with Openhab, Influxdb 1.8.10, and Grafana. So I can do the migration towards my NUC slowly, even tried to include the 2.4 step but due to difference between docker run and compose I was clueless why I did not have access.

So for the time being I remain on 1.8.10; I am also not sure what the benefit is if I would use 2.4; as a single user there is no added value for the extra fields???

BTW My docker run version is:

version: “2.2”

services:
  
  # StART WITH IF NOT YET CREATED
  # docker volume create influxdb-data

  influxdb:
    image: influxdb:1.8
    container_name: influxdb18
    restart: always
    network_mode: host
    environment:
      #- INFLUXDB_HTTP_AUTH_ENABLED=TRUE 
      - INFLUXDB_DB="openhab"
      #- INFLUXDB_ADMIN_USER="admin"
      #- INFLUXDB_ADMIN_PASSWORD="paswoord"
      #- INFLUXDB_WRITE_USER="openhab"
      #- INFLUXDB_WRITE_USER_PASSWORD="paswoord
      #- INFLUXDB_READ_USER="grafana"
      #- INFLUXDB_READ_USER_PASSWORD="paswoord"
    volumes:
      - influxdb-storage:/var/lib/influxdb
volumes:
  influxdb-storage:
    external: true

Creation of a database works, INFLUXDB_HTTP_AUTH_ENABLED works also but because the admin user is not created you will be out of access. Perhaps I missed something. If I omit -d in docker compose my eyes notice the following remark:

**Auth is enabled but shared-secret is blank. BearerAuthentication is disabled.**

Maybe I forgot to add a line in docker compose, any suggestions?