Influx docker container keeps restarting due to default config already being defined

Hi there,

I am relatively new to Influx and currently trying to include it into a docker compose setup. I use the latest version of the influx image from docker hub and defined all the DOCKER_INFLUXDB_* environment variables including DOCKER_INFLUXDB_INIT_MODE=setup to make the container setup a new influx config for the standard port once the container runs the first time.
Also I have a named volume influx_data mounted into /var/lib/influxdb2 to make the data persistent.

This setup worked perfectly fine on my machine, but it does not start on the machine of my colleagues. The influx container keeps restarting due to an the Error: default config already exists.

This looks like some kind of race condition with influx setup running twice or even influx setup -c default because otherwise I cannot reproduce this error by using the CLI myself.

Did anyone ever experience something similar or has an idea what the problem could be? If you have any further questions about the setup, please aks. I wanted to keep it short and only include the information relevant from my point of view, but let me know if you need some more information.

Thanks in advance!

@lrilling I’d expect to see that error if your colleague has an existing CLI config file mounted at /etc/influxdb2/influx-configs. They could either delete that file or set the env var DOCKER_INFLUXDB_INIT_CLI_CONFIG_NAME to something other than default

Hey @dan-moran,

thanks for your reply. That’s what I thought aswell, but it also happens on machines that didn’t execute the setup at all so far with only one mount for the data persistence at /var/lib/influxdb2.

That’s the service configuration in the docker-compose.yml:

    image: influxdb:latest
      - "8086:8086"
    restart: on-failure
      - influx_data:/var/lib/influxdb2
      - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=4eYvsu8wZCJ6tKuE2sxvFHkvYFwSMVK0011hEEiojvejzpSaij86vYQomN_12au6eK-2MZ6Knr-Sax201y70w==

But since you confirmed to me the error should only happen when there is some config mounted already, I think the error may lie somewhere else. Since the plain influx image already defines a Volume for /etc/influxdb2/ maybe the container crashes for some other reason and since it restarts on-failure on the second start it already has a config mounted in the unnamed volume…

I’ll look into that.
Thanks again for your answer!