I'm attempting to run an ELK stack using Docker. I found docker-elk which has already set up the config for me, using docker-compose
.
I'd like to store the elasticsearch data on the host machine instead of a container. As per docker-elk's README, I added a volumes
line to elasticsearch
's section of docker-compose.yml
:
elasticsearch:
image: elasticsearch:latest
command: elasticsearch -Des.network.host=0.0.0.0
ports:
- "9200"
- "9300"
volumes:
- ../../env/elasticsearch:/usr/share/elasticsearch/data
However, when I run docker-compose up
I get:
$ docker-compose up
Starting dev_elasticsearch_1
Starting dev_logstash_1
Starting dev_kibana_1
Attaching to dev_elasticsearch_1, dev_logstash_1, dev_kibana_1
kibana_1 | Stalling for Elasticsearch
elasticsearch_1 | [2016-03-09 00:23:35,193][WARN ][bootstrap ] unable to install syscall filter: seccomp unavailable: your kernel is buggy and you should upgrade
elasticsearch_1 | Exception in thread "main" java.lang.IllegalStateException: Unable to access 'path.data' (/usr/share/elasticsearch/data/elasticsearch)
elasticsearch_1 | Likely root cause: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/elasticsearch
elasticsearch_1 | at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
elasticsearch_1 | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
elasticsearch_1 | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
... etc ...
Looking in ../../env
, the elasticsearch
directory was indeed created, but it was empty. If I create ../../env/elasticsearch/elasticsearch
then I get an access error for /usr/share/elasticsearch/data/elasticsearch/nodes
. If I creates /nodes
then I get an error for /nodes/0
, etc...
In short, it appears that the container doesn't have write permissions on the directory.
How do I get it to have write permissions? I tried chmod a+wx ../../env/elasticsearch
, and then it manages to create the next directory, but that directory has permission drwxr-xr-x
and it gets stuck again.
I don't like the idea of having to run this as root.