elastic search won't run with data volume mapped
I'm on a mac. I use the command docker run -d -v "$PWD/esdata":/usr/share/elasticsearch/data -p 9200:9200 -p 9300:9300 elasticsearch to launch elastic but it immediately shuts down with this message
{1.7.3}: Initialization Failed ...
- ElasticsearchIllegalStateException[Failed to created node environment] AccessDeniedException[/usr/share/elasticsearch/data/elasticsearch]
Any ideas on how to fix?
This is a permissions issue since the mounted folder from your host is owned by uid/gid 1000:50 whereas the user in the container is elasticsearch (105:108). There is much discussion over on https://github.com/boot2docker/boot2docker/issues/581.
thanks for responding @yosifkit.
I am also facing the issue, I solved it with adding this to my Dockerfile:
RUN usermod -u 1000 www-data
RUN groupmod -g 1000 www-data