InfluxDB does not respect data from copied docker volume

Hello,

initially i had a docker stack (using docker-compose) which used the influxdb docker image (version 1.8) and stored the data on a docker-compose managed named volume.

Now, the application layout changed and i need to transfer the data from the previous stack to the new one. So i thought it would be easy and i copy the contents from the old volume to the new one and i can just start my new stack and it will be alright.

I used Guido Diepen’s script (docker-convenience-scripts/docker_clone_volume.sh at master · gdiepen/docker-convenience-scripts · GitHub) for transfering the data.
After copying i compared the content of the volumes and they are exactly the same.

But now when i launch the new stack, influxdb still starts from “scratch” and wants me to create an admin user etc., it does not take the existing data into account. It seems some information is missing.

I also found another way to “solve” this partially using backup and restore (but needed to realise that the backup functionality does not include the user data - see No way to make a full(users+databases) restore from '-portable' backup · Issue #9723 · influxdata/influxdb · GitHub). At least my data is transfered.

This is why i would prefer my initial approach.

Can somebody explain while the existing data is not used? Or if it is possible to make it work like this at all?

Hello @maggie,
I don’t know but I’m asking an expert.

Can you post your before & after docker-compose configs? And log messages from starting the server with the new config?

The purpose is to see if i can reuse a copied docker volume for influxdb (copying for the case i need to go back to the old state, which still has the old data available as a backup).
The docker-compose files for this test are exactly same except for the external: true flag.

version: "3.8"

services:
  influxdb:
    image: influxdb:1.8.1
    volumes:
      - type: volume
        source: test-influxdb-vol    # influxdb-vol on the "old" stack
        target: /var/lib/influxdb
      - type: bind
        source: ./cfg/influxdb/influxdb.conf
        target: /etc/influxdb/influxdb.conf
        read_only: true
    ports:
      - 8088:8088
      - 8086:8086
    restart: always

volumes:
  test-influxdb-vol:    # influxdb-vol on the "old" stack
    external: true

However, while preparing that post found the root cause: Me :roll_eyes:

The influxdb data in the docker volume (also a test volume) i was copying from didnt have the admin user configured either. After configuring it and performing the copy and reuse procedure again, it is working as expected.

But thanks for taking a look into it!