尝试在Docker容器中运行弹性服务时禁用[groovy]的动态脚本

时间:2018-12-26 19:07:05

标签: docker elasticsearch

我在Rails应用程序中使用elasticsearch 1.4.4。要在本地启动,我下载弹性from there,解压,添加

script.inline: on
script.indexed: on

elasticsearch-1.4.4/config/elasticsearch.yml并运行elasticsearch-1.4.4/bin/elasticsearch

测试通过,没有错误。当我尝试将Elasticsearch Service作为Docker容器启动时,请执行以下步骤:

添加Dockerfile.elasticsearch-1.4.4

FROM elasticsearch:1.4.4

RUN echo 'script.inline: on' >> /etc/elasticsearch/elasticsearch.yml
RUN echo 'script.indexed: on' >> /etc/elasticsearch/elasticsearch.yml

CMD ["elasticsearch"]

构建图像:

docker build - < Dockerfile.elasticsearch-1.4.4 -t hirurg103/elasticsearch-1.4.4:1.0

启动容器:

docker run -p 9200:9200 "hirurg103/elasticsearch-1.4.4:1.0"

当我运行测试时,其中一些失败

nested: ScriptException[dynamic scripting for [groovy] disabled

我尝试使用docker构建elasticsearch 1.6.12.0.0,但错误仍然相同

如何更改Dockerfile,使其可以为elasticsearch服务执行脚本?

1 个答案:

答案 0 :(得分:0)

我能够从以下Dockerfile中启用脚本,并通过elasticsearch编译docker映像:

FROM elasticsearch:1.4.4

...

RUN echo 'script.inline: on' >> /etc/elasticsearch/elasticsearch.yml
RUN echo 'script.indexed: on' >> /etc/elasticsearch/elasticsearch.yml
RUN echo 'script.disable_dynamic: false' >> /etc/elasticsearch/elasticsearch.yml
...
CMD ["elasticsearch", "-Des.config=/etc/elasticsearch/elasticsearch.yml"]
# Note this line! ^

由于某种原因(似乎不确定),elasticsearch似乎忽略了配置文件/etc/elasticsearch/elasticsearch.yml。如果您有任何想法,请在评论中分享它们