I have a working ES docker container running that I run like so
docker run -p 80:9200 -p 9300:9300 --name es-loaded-with-data --privileged=true --restart=always es-loaded-with-data
I loaded up ES with a bunch of test data and wanted to save it in that state so I followed up with
docker commit containerid es-tester
docker save es-tester > es-tester.tar
then when I load it back in the data is all gone... what gives?
docker load < es-tester.tar
If you started from the official ES image, it is using a volume (https://github.com/docker-library/elasticsearch/blob/7d08b8e82fb8ca19745dab75ee32ba5a746ac999/2.1/Dockerfile#L41). Because of this, any data written to that volume will not be committed by Docker.
In order to backup the data, you need to copy the data out of the container: docker cp <container name>:/usr/share/elasticsearch/data <dest>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With