我目前正在构建一个用于集成测试的自定义泊坞窗镜像。我的要求是使用默认的ingester管道和模板映射进行自定义配置。如何将elasticsearch模板与docker映像捆绑在一起?
Dockerfile:
FROM docker.elastic.co/elasticsearch/elasticsearch:5.6.2
ADD config /usr/share/elasticsearch/config/
USER root
RUN chown -R elasticsearch:elasticsearch config
RUN chmod +x config/setup.sh
USER elasticsearch
RUN elasticsearch-plugin remove x-pack
EXPOSE 9200
EXPOSE 9300
其中配置是包含目录:
> elasticsearch.yml for the configuration
> templates in the form of json files
> setup.sh - script which executes curl to es in order to register pipelines to _ingester and template mappings
安装脚本是这样的:
#!/bin/bash
# This script sets up the es5 docker instance with the correct pipelines and templates
baseUrl='127.0.0.1:9200'
contentType='Content-Type:application/json'
# filebeat
filebeatUrl=$baseUrl'/_ingest/pipeline/filebeat-pipeline?pretty'
filebeatPayload='@pipeline/filebeat-pipeline.json'
echo 'setting filebeat pipeline...'
filebeatResult=$(curl -XPUT $filebeatUrl -H$contentType -d$filebeatPayload)
echo -e "filebeat pipeline setup result: \n$filebeatResult"
# template
echo -e "\n\nsetting up templates..."
sleep 1
cd template
for f in *.json
do
templateName="${f%.*}"
templateUrl=$baseUrl'/_template/'$templateName
echo -e "\ncreating index template for $templateName..."
templateResult=$(curl -XPUT $templateUrl -H$contentType [email protected]$f)
echo -e "$templateName result: $templateResult"
sleep 1
done
echo -e "\n\n\nCompleted ES5 Setup, refer to logs for details"
如何构建和运行该图像以这样的方式在脚本之后执行弹性是否正在运转?
你的'setup.sh'脚本是怎么样的? – Val