我正在尝试使用 Docker 运行 ELK 堆栈。我发现docker-elk已经为我设置了配置,使用docker-compose
.
我想将弹性搜索数据存储在主机而不是容器上。根据 docker-elk 的自述文件,我在's 部分添加了volumes
一行:elasticsearch
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
但是,当我跑步时,docker-compose up
我得到:
$ 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 ...
查看,确实创建../../env
了目录,但它是空的。elasticsearch
如果我创建../../env/elasticsearch/elasticsearch
然后我得到一个访问错误/usr/share/elasticsearch/data/elasticsearch/nodes
。如果我创建/nodes
然后我得到一个错误/nodes/0
,等等......
简而言之,容器似乎没有目录的写权限。
我如何让它具有写权限?我试过chmod a+wx ../../env/elasticsearch
了,然后它设法创建了下一个目录,但是那个目录有权限drwxr-xr-x
,它又卡住了。
我不喜欢必须以 root 身份运行它的想法。