Upgrade InfluxDB from quay.io/influxdb/influxdb:v2.0.3 to docker hosted InfluxDB 2.4.0

Hi, I am using InfluxDB OSS quay.io /influxdb/influxdb:v2.0.3. Now I am trying to upgrade InfluxDB 2.0.9 to Docker hub 2.4.0 but I am losing the older data.

I also tried to follow Docker this documentation but still, I am losing the data.

I am attaching my docker-compose where I have defined all the configurations.

version: "3"
services:
  influxdb:
    image: influxdb:2.1.0
    container_name: influxdb
    restart: always
    ports:
      - 8086:8086
    networks:
      - analytics
        #command: bash -c "influxd 2>&1 | tee -a /var/log/influxdb/influxdb.log"
    volumes:
      - /mnt/influxdb/:/root/.influxdbv2/engine
      - /mnt/data/influxdb/influxd.bolt:/root/.influxdbv2/influxd.bolt
      - ./etc/influxdb/project1/:/etc/influxdb/project1/
      - ./etc/influxdb/project2/:/etc/influxdb/project2/
      - ./etc/influxdb/log:/var/log/influxdb
    environment:
      - INFLUXD_BOLT_PATH=/root/.influxdbv2/influxd.bolt
      - INFLUXD_ENGINE_PATH=/root/.influxdbv2/engine
    user: root
    logging:
      options:
        max-size: "10m"
        max-file: "3"
networks:
  analytics:

When we run this docker-compose
we get the error as permission denied: not able to create the root directory

We have tried running docker-compose using sudo.
We also tried giving all the permission to /mnt/influxdb/ and /mnt/data/influxdb/influxd.bolt but still we are losing the data.

@Anaisdg @Jay_Clifford could you please help on this?

Thanks

Hi @Pratik_Das_Baghel,

I would consider trying to swap volume mount path instead of changing the bolt path in the container itself:

# Migrate from this:
$ docker run -p 8086:8086 \
      -v $PWD:/root/.influxdbv2 \
      quay.io/influxdb/influxdb:v2.0.3

# To this:
docker run -p 8086:8086 \
      -v $PWD:/var/lib/influxdb2 \
      influxdb:2.0

If this fails you could run a full backup of the 2.0.4 instance and migrate that to a brand new instance of InfluxDB 2.6