0

我有用于弹性搜索和 kibana 的 dockerized 容器运行,一旦我启动 docker 容器,它就会自动安装一些插件。

我需要编辑 config/elasticsearch.yml 文件以启用该插件的使用,并且我试图找到完成它的方法,类似于我通过文件安装插件的方式,如下所示

ARG ELASTIC_VERSION="$ELASTIC_VERSION"

FROM docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION}

RUN bin/elasticsearch-plugin install https://github.com/spinscale/elasticsearch-ingest-opennlp/releases/download/7.6.0.1/ingest-opennlp-7.6.0.1.zip
RUN bin/elasticsearch-plugin install mapper-annotated-text
RUN bin/elasticsearch-plugin install analysis-phonetic
RUN bin/elasticsearch-plugin install ingest-attachment --batch
RUN bin/ingest-opennlp/download-models
4

2 回答 2

0

正确的方法是创建一个新的 docker 镜像:

  1. 使用 elasticsearch 作为基础镜像创建一个新的 Dockerfile。覆盖此镜像中的 elasticsearch.yml 文件。现在,构建这个图像
FROM elasticsearch
COPY elasticsearch.yml config/elasticsearch.yml
  1. (可选)将此图像推送到 dockerhub
  2. 使用此映像进行部署
于 2020-02-26T13:37:21.460 回答
0

已解决,感谢所有受https://stackoverflow.com/a/49755244/12851178
启发的帮助

更新了弹性搜索文件;将其保留在这里以供其他人将来参考

ARG ELASTIC_VERSION="$ELASTIC_VERSION"

FROM docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION}

RUN bin/elasticsearch-plugin install https://github.com/spinscale/elasticsearch-ingest-opennlp/releases/download/7.6.0.1/ingest-opennlp-7.6.0.1.zip
RUN bin/elasticsearch-plugin install mapper-annotated-text
RUN bin/elasticsearch-plugin install analysis-phonetic
RUN bin/elasticsearch-plugin install ingest-attachment --batch
RUN bin/ingest-opennlp/download-models


RUN echo "ingest.opennlp.model.file.persons: en-ner-persons.bin" >> /usr/share/elasticsearch/config/elasticsearch.yml
RUN echo "ingest.opennlp.model.file.dates: en-ner-dates.bin" >> /usr/share/elasticsearch/config/elasticsearch.yml
RUN echo "ingest.opennlp.model.file.locations: en-ner-locations.bin" >> /usr/share/elasticsearch/config/elasticsearch.yml
于 2020-03-02T04:21:12.620 回答