Retain CLI config after Docker container restart

CLI configurations created with influx config do no longer show up after restarting the Docker container. According to the docs, they should be located in ~/.influxdbv2/configs. However, this folder does not exist inside the container (neither in /root or /home/influxdb), even after a new configuration is created. Is this path different in the Docker image? How can I retain the config after a reboot?

Hi @kennymc.c,
Can you try and mount the following volumes:

docker run -p 8086:8086 \
      -v $PWD:/var/lib/influxdb2 \
      influxdb:latest

I have already mounted this directory. Otherwise all buckets would be gone after a reboot. The config folder is not in there either.

Hi @kennymc.c,
My Apologies so I believe unless you mount your own configuration then a default is generated. The default config is located here:

cat /etc/defaults/influxdb2/config.yml

I will need to check with the edge team to see if this configuration file is also the one affected by the changes you are making. In the meantime, you could pull this configuration file and create your own config file manually. You will then need to mount it here. This is the default location for configuration mounts:

-v $PWD/config:/etc/influxdb2

https://hub.docker.com/_/influxdb#:~:text=Endpoints%20%26%20Ports%20here.-,Configuration,-InfluxDB%20can%20be

/etc/influxdb2/influx-configs contains my configuration. I have now restarted and stopped and restarted the container and the configuration now suddenly remains. I will continue to monitor the problem. Can it be that when the image is updated and Docker pulls it, this file is then overwritten and thus I have the default configuration again?

My solution is: mount /etc/influxdb/ on the host system and create the config via CLI. Then the influx-configs file also appears on the host system and should not be overwritten after an update.
I just wonder why it is not in the user home directory as specified. Or is this a different file?