Where is the docker data stored?

The InfluxDB2 docs have a “Getting started” for docker - great. However there is ZERO documentation (Even on the other ‘getting started’ editions) as to where data is stored. What volumes do I mount if I want the data to last though a restart?

I’ve guessed that some is in /root/.influxdbv2/ and… beyond that no idea.

Through trial and error I figured out that the docker image does not persist data to disk by default.

I’m using this docker-compose file that persists changes to disk. Check the CLI reference for details.

version: "3.1"
services:
  influxdb:
    container_name: influxdb
    ports:
      - '9999:9999'
    image: 'quay.io/influxdb/influxdb:2.0.0-alpha'
    volumes:
      - influxdb:/var/lib/influxdb2
    command: influxd run --bolt-path /var/lib/influxdb2/influxd.bolt --engine-path /var/lib/influxdb2/engine --store bolt

volumes:
  influxdb:
5 Likes

Hi,

Thanks for posting this docker-compose file, it was very helpful.
I am facing another issue, when I write data with GitHub - influxdata/influxdb-client-js: InfluxDB 2.0 JavaScript client and the following docker-compose file it doesn’t write any data, it times out. But when if I remove volume in docker-compose and write the data, it goes through, but obviously is wiped out as soon as I restart my docker.

version: ‘2.0’
services:
influxdb2_vol:
container_name: influxdb2_vol
ports:
- ‘9999:9999’
image: ‘Quay
volumes:
- /home/bhoomi/influxdb2_1:/var/lib/influxdb2
command: influxd run --bolt-path /var/lib/influxdb2/influxd.bolt --engine-path /var/lib/influxdb2/engine --store bolt

I don’t get any error in docker logs.

Please help.

Hi,
I also had a bit of hard time with this, it can be solved also without docker compose, I write here for other that may find it useful. Docker can pass flags to the executable so simply one needs to add the following flags: –bolt-path and –engine-path. An example below:

sudo docker run  -p 9999:9999 -v _local_path_bolt:/var/influx/bolt -v _local_path_engine:/var/influx/engine quay.io/influxdb/influxdb:2.0.0-beta --bolt-path /var/influx/bolt/influxd.bolt --engine-path /var/influx/engine

Here I mount 2 volumes, one for the bolt (where all the configs are) and one for the engine (where all the data are). Like this data and configs will survive a restart, separating it in two different volumes is not necessary, just my convenience.

Cheers.

2 Likes