Persist influxDB data between machines with docker

Viewed 451

I'm having an issue with data persistence in influxDB running in a docker container. The influxDB container is spun up with the following docker-compose file:

services:
  influxdb:
    image: influxdb:1.8.6
    restart: always
    container_name: influxDB
    volumes:
      - ./influxDB_data:/var/lib/influxdb
    ports:
      - "8083:8083"
      - "8086:8086"
    environment:
      - INFLUXDB_ADMIN_USER=admin
      - INFLUXDB_ADMIN_PASSWORD=xxxx
      - INFLUXDB_DB=openhab_db

So the data should be persisted on the local folder ./influxDB_data and when I shutdown docker-compose down and restart docker-compose up -d the container this seems to be the case, because all the time series data is still there.

But if I shutdown the container and move all files from the local ./influxDB_data folder to a different machine and spin up the container there, only the database settings are persisted, all the series data is lost. It seems, that not all the data from influx is stored at /var/lib/influxdb (maybe in ram or a different location?). But if this is the case, why is the data persisted on the same machine in the first place? And does anyone know how this could be fixed?

0 Answers
Related