Elasticsearch on docker: Volume mounted as root user leading to permission issue

Thanks for your replies Toby.

volumes

  • es-master1:/usr/share/elasticsearch/data

If I add the volume info as above, then elasticsearch instances run but they are not using host filesystem for persistence. It is using /usr/share/elasticsearch/data on the container.
As I mentioned earlier, the only way I can get it to work is if I use bind mount as below:

volumes

  • "/data/es-data:/usr/share/elasticsearch/data"

Is there any drawback to use it in this manner?
Will go through the above thread. Thanks.