I am trying to start the ELK stack using Docker. I found docker-elk that has already configured for me using docker-compose
.
I would like to save elasticsearch data on the host machine instead of the container. According to docker-elk README, I added the volumes
line to the elasticsearch
of the 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 ...
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 create /nodes
, then I get an error message for /nodes/0
, etc.
In short, it looks like the container does not have write permissions in the directory.
How do I get write permissions? I tried chmod a+wx ../../env/elasticsearch
and then he managed to create the following directory, but this directory has permission drwxr-xr-x
and it gets stuck again.
I don't like the idea of โโrunning this as root.
source share