influxdata-docker icon indicating copy to clipboard operation
influxdata-docker copied to clipboard

Cannot create a regular user

Open ghost opened this issue 6 years ago • 4 comments

In the docker hub page of influxdb in section Database Initialization it is mentioned, that with variables INFLUXDB_USER and INFLUXDB_USER_PASSWORD I can create a regular user for the specified INFLUXDB_DB database. But this does not work.

My docker-compose.yml looks like this:

version: "3"
services:
    influxdb:
        container_name: influxdb
        restart: unless-stopped
        image: influxdb
        environment:
            - INFLUXDB_DB=testdb
            - INFLUXDB_HTTP_AUTH_ENABLED=true
            - INFLUXDB_USER=myuser
            - INFLUXDB_USER_PASSWORD=mypass
        ports:
            - "8086:8086"
        volumes:
            - influx-data:/var/lib/influxdb

volumes:
    influx-data:

In the log I see, that it does not create the user, but tries to create the database and gets 403, obviously. Eventually, the initialisation fails.

It works fine for the admin user, but I do not want to create a user with full privileges, since I only need to access that particular db.

What am I doing wrong here?

ghost avatar Dec 14 '18 13:12 ghost

Same problem here. Remove your volume and try again. It works for me.

acanimal avatar Dec 28 '18 09:12 acanimal

thanks for the info, I will check it

ghost avatar Jan 07 '19 09:01 ghost

I have the same issue, it will just keep doing a GET /ping, then a POST /query?...CREATE+DATABASE... The POST results in a 403, so creation of database fails. If I include an ADMIN user in my docker-compose, then it creates that first, and the rest goes smoothly. But just like oxyole, I don't want/need an ADMIN user. Can the script be fixed please for this use case?

eriklogtenberg avatar Jan 22 '19 13:01 eriklogtenberg

Hi, I initially started creating an InfluxDB without any authentication at all. After some time, I decided to secure it by specifying a new user in the docker compose file, using a similar set up than the one specified in the first post of this issue.

However, the user does not get created... (it only works if I delete the volume but that's not an option as I'd lose data). Is there any workaround for this?

felipecruz91 avatar Mar 25 '20 18:03 felipecruz91