DEV Community

Cover image for Elastic container and persisting
Visakh Vijayan
Visakh Vijayan

Posted on • Edited on

Elastic container and persisting

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

Top comments (0)