Dockerfiles for building Centos based elasticsearch images.
latest(7.6.0/Dockerfile)7.6.0(7.6.0/Dockerfile)7.2.0(7.2.0/Dockerfile)6.8.0(6.8.0/Dockerfile)6.5.0(6.5.0/Dockerfile)5.6.9(5.6.9/Dockerfile)
Since Elasticsearch runs inside a contianer we have to make following changes
-
Docker networking hides the containers from the networking stack on the host machine. The problem is when you start elasticsearch, you have to host addresses. Either we have to publish all ports or update elasticsearch.yml with below settings, and define PUBLISH_IP as an environment variable.
network.bind_host: 0.0.0.0 network.publish_host: "${PUBLISH_IP}" -
Create/update sysctl configurations and Docker startup options to fix max_file_descriptions error during elasticsearch start up. /etc/sysconfig/docker with below values
DAEMON_MAXFILES=1048576 OPTIONS="--default-ulimit nofile=1024:65536" DAEMON_PIDFILE_TIMEOUT=10 -
Create/update sysctl.d limits on host machine and update sysctl to reflect immediately
vm.max_map_count=262144 fs.file-max=100000 -
Please define below variables during run time to replace default values, variables defined during run time will take the highest priority, each variable should be passed differently with option -e
| Attribute name | Default Value |
|---|---|
| ES_JAVA_OPTS | -Xms2g -Xmx2g |
- install docker-engine https://docs.docker.com/engine/installation/
- This image can be used by simply running as a standalone elasticsearch host
$ docker run --name=elasticsearch -p 9200:9200 -v /etc/elasticsearch:/usr/local/elasticsearch/config -td phenompeople/elasticsearch
Above command runs elasticsearch container with port 9200 mapped to host and reading configuration files mapped under /etc/elasticsearch.
- In a multi node elasticsearch cluster, to make nodes to communicate each other publish 9300 also in-addition to above command
$ docker run --name=elasticsearch -p 9200:9200 -p 9300:9300 -v /etc/elasticsearch:/usr/local/elasticsearch/config -td phenompeople/elasticsearch
- To make image run even after reboot use extra option --restart=always
$ docker run --restart=always --name=elasticsearch --name=elasticsearch -p 9200:9200 -p 9300:9300 -v /etc/elasticsearch:/usr/local/elasticsearch/config -td phenompeople/elasticsearch
- Rajesh Jonnalagadda (rajesh.jonnalagadda@phenompeople.com)
- Harshavardhan Baddam (harshavardhan.baddam@phenompeople.com)
License: Apache License
Author : Phenompeople Pvt Ltd (admin.squad@phenompeople.com)