Azrix
Azrix

Reputation: 109

How to export an Influxdb database which is in a docker container?

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

Upvotes: 2

Views: 4198

Answers (1)

vivekyad4v
vivekyad4v

Reputation: 14823

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 ./

Upvotes: 5

Related Questions