How to do a simple edit in elasticsearch.yml in a docker container?

本秂侑毒 提交于 2020-07-05 12:33:13

问题


I am using docker-compose as in https://github.com/davidefiocco/dockerized-elasticsearch-indexer/blob/master/docker-compose.yml to initialize a containerized elasticsearch index.
Now, I would like to set a larger value for indices.query.bool.max_clause_count than the default setting using a elasticsearch.yml config file.

So far I tried to add in the docker-compose.yml a volume with:

services:
   elasticsearch:
      volumes:
        - ./elasticsearch/config/elasticsearch.yml

(and variations thereof) trying to point to a elasticsearch.yml file (that I would like to ship with the rest of the files) with the right max_clause_count setting, but to no avail.

Can someone point me to the right direction?


回答1:


You can mount the host's directory containing the elasticsearch.yml into the container using

services:
   elasticsearch:
      volumes:
        - path_to/custom_elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro



回答2:


One workaround to perform that (trivial) modification to elasticsearch.yml in the container is to modify directly a relevant Dockerfile with the syntax

USER root
RUN echo "indices.query.bool.max_clause_count: 1000000" >> /usr/share/elasticsearch/config/elasticsearch.yml

so to append the desired custom value.



来源:https://stackoverflow.com/questions/49751843/how-to-do-a-simple-edit-in-elasticsearch-yml-in-a-docker-container

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!