DEV Community

loading...
Cover image for Elastic container and persisting

Elastic container and persisting

Visakh Vijayan
Willing to learn anything and everything exciting. Always awake. Skips food for fun.
Updated on ・1 min read

Spent quite some time trying to persist data of elastic container to the host machine. Here is how to do it finally -

elastic_db:
        container_name: elastic_db
        image: elasticsearch:7.6.2
        ports:
            - "9200:9200"
        environment:
            - discovery.type=single-node
            - "ES_JAVA_OPTS=-Xms400m -Xmx400m"
        volumes:
            - ./elastic-volume:/usr/share/elasticsearch/data:rw
Enter fullscreen mode Exit fullscreen mode

I have mapped the host folder elastic-volume over here. Give permissions to the folder so that it can be written into.

Hope this helps someone! :D

Discussion (0)