I am struggling for the last couple of days to move my current stand-alone influx (V2.7.0) installation to Docker (V2.7.5). I am trying to mount my current non-Docker data and config files to Docker volumes:
What happens is that I simply copy and paste config and data dirs to appropriate Docker volumes (i.e. host folders). However, each time it loads a container, it runs setup and no data, no configuration is kept. Is it possible to move influx this way to Docker at all? I also tried the same version of container V2.7.0, but no luck. I have also tried to move CLI configurations into influx-configs files, but also that did not help and I also got error that default configuration already exists.
And it says that dirs should be like the ones I used. Am I wrong? If I used your version, how would it know and find *.bolt file with last setup? Manual says that if it does not find one, it will rerun setup again.
Try starting the container without the InfluxDB .env file. Since you’re mounting already established directories, InfluxDB shouldn’t need to go through the setup process. All of those environment variables are meant to trigger and automate the setup process. I think that’s why it keeps going into setup mode.
These instructions are really meant for standing up a new InfluxDB instance in a Docker container rather than moving an InfluxDB instance from the host machine into a container.
@roflasvolumes in a compose file creates named volumes, but in your case, you might try specifying bind mount in your compose file to mount your existing fs directories into the container directories.
Alternatively, if you want to use named volumes, you could use the Docker CLI to create them for your existing fs directories and then use them in your compose file.
Thanks for help. I ended up just setting the system from scratch and restoring the backup. It is now fine although it is still unclear, why I was not able to mount it
hi @roflas can you tell me what you did for “starting system from scratch” exactly? I’m facing the same issue and I already tried deleting the volumes.
Hey, I just configured basic installation with basic settings (in docker compose file), but later I just restored full backup of my previous DB. Full backup restores everything including tokens etc. So basically you will have the same thing you had before. This way I did not have to worry about using old influx data folders and attaching them to docker volumes, but I “made” good volumes after restoring backup.
Thanks a lot @roflas you made our day. I started a plain container without any env set, just like you and went ahead to delete the bolt file in /var/lib/influxdbv2/data/influxd.bolt. And later did docker compose to my original file that has env vars. And it worked