启用Docker映像中的脚本 [英] enable scripting within docker image
问题描述
我可以使用以下2个docker命令启动弹性搜索:
docker run -d -p 9200: 9200 -p 9300:9300 --name elasticsearch-pb elasticsearch
docker run -d -p 5601:5601 --name kibana-pb --link elasticsearch-pb:elasticsearch -e ELASTICSEARCH_URL = http:// elasticsearch: 9200 kibana
但是如何使用docker启动脚本支持?
通常这可以通过在elasticsearch.yml文件中添加2行来完成。
script.inline: on
script.indexed:on
如何更改docker映像中的配置文件?
构建包含这些选项的自定义图像。
创建您的码头图像的目录
mkdir my_elasticsearch
/ pre>
cd my_elasticsearch
创建一个
elasticsearch.yml
,其中包含所有选项,包括script.inline:on
script.indexed:on
创建复制配置文件的
Dockerfile
。
pre>from elasticsearch
copy elastcsearch.yml /container/path/to/elasticsearch.yml
构建和标记图像
docker build -t my / elasticsearch。
然后运行您的图像
docker run -d -p 9200:9200 -p 9300:9300 --name elasticsearch-pb my / elasticsearch
您可能希望将图像发布到 Docker Hub 或其他注册表你只需要构建一次。
您还可以使用 docker-compose 管理构建过程和多个容器。
I can start elasticsearch with Kibana using the following 2 docker commands...
docker run -d -p 9200:9200 -p 9300:9300 --name elasticsearch-pb elasticsearch
docker run -d -p 5601:5601 --name kibana-pb --link elasticsearch-pb:elasticsearch -e ELASTICSEARCH_URL=http://elasticsearch:9200 kibana
But how do I start es with script support using docker?
Usually this is done by adding 2 lines to elasticsearch.yml file.
script.inline: on
script.indexed: on
how do I change the config file within docker image?
Build a custom image that includes those options.
Create a directory for your docker image
mkdir my_elasticsearch
cd my_elasticsearch
Create an elasticsearch.yml
with all the options including
script.inline: on
script.indexed: on
Create a Dockerfile
that copies the config file.
from elasticsearch
copy elastcsearch.yml /container/path/to/elasticsearch.yml
Build and tag the image
docker build -t my/elasticsearch .
Then run your image
docker run -d -p 9200:9200 -p 9300:9300 --name elasticsearch-pb my/elasticsearch
You might want to publish your image to the Docker Hub or another registry so you only need to build it once.
You can also use docker-compose to manage the build process and multiple containers.
这篇关于启用Docker映像中的脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!