2

I want to export my influxdb database as mentioned here, but my InfluxDB is in a docker container, and I'm still a beginner with it. How can I execute the following command into my container ? influxdb backup -database name /opt/data

Azrix
  • 99
  • 1
  • 10

1 Answers1

5

You can do a docker exec & docker cp to backup your data in case you have not used host mounts -

docker exec -it $CONTAINER_ID bash -c "influxdb backup -database name /opt/data"

Once your data is generated in /opt/data, copy it to the current directory on Docker host -

docker cp $CONTAINER_ID:/opt/data ./
vivekyad4v
  • 13,321
  • 4
  • 55
  • 63
  • 2
    The proper tool name is 'influxd' not 'influxdb'. Also it is recommended to use the new format by specifying -portable. See https://docs.influxdata.com/influxdb/v1.8/administration/backup_and_restore/ – Sebastiaan M Jul 26 '20 at 10:12