Public Repository

Last pushed: a year ago
Short Description
https://www.elastic.co/blog/how-to-make-a-dockerfile-for-elasticsearch
Full Description

Vagrantfile

Vagrant.configure(2) do |config|

config.vm.box = "ubuntu/trusty64"

#Mongo DB Ports
config.vm.network "forwarded_port", guest: 27017, host: 27017
config.vm.network "forwarded_port", guest: 28017, host: 28017

#RabbitMQ Ports
config.vm.network "forwarded_port", guest: 5672, host: 5672
config.vm.network "forwarded_port", guest: 15672, host: 15672

#Redis Ports
config.vm.network "forwarded_port", guest: 6379, host: 6379

#Elasticsearch Ports
config.vm.network "forwarded_port", guest: 9200, host: 9200
config.vm.network "forwarded_port", guest: 9201, host: 9201
config.vm.network "forwarded_port", guest: 9300, host: 9300
config.vm.network "forwarded_port", guest: 9301, host: 9301

#Kibana Ports
config.vm.network "forwarded_port", guest: 5601, host: 5601

#Logstash Ports
config.vm.network "forwarded_port", guest: 5400, host: 5400

config.vm.provider :virtualbox do |v|
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpus", 2]
end

end

elasticsearch.yml

#path.data: /vagrant/es/master-instance/data

#path.logs: /vagrant/es/master-instance/log

#path.work: /vagrant/es/master-instance/work

cluster.name: as-docker-es-1
node.name: as-docker-node-1

network.host: 0.0.0.0

#change according to config
http.port: 9200
transport.tcp.port: 9300

discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["10.0.2.15:9300", "10.0.2.15:9301"]

logging.yml

rootLogger: INFO,console
appender:
console:
type: console
layout:
type: consolePattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"

Dockerfile

#

#Elasticsearch Dockerfile
#

#https://github.com/dockerfile/elasticsearch
#

#Pull base image.
FROM java:8
MAINTAINER Ashok Mor amor@asite.com

#ENV ES_PKG_NAME elasticsearch-2.3.3

Create user

RUN groupadd -g 1000 elasticsearch && useradd elasticsearch -u 1000 -g 1000

Install Elasticsearch.

RUN \
cd / && \
wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.3.3/elasticsearch-2.3.3.tar.gz && \
tar xvzf elasticsearch-2.3.3.tar.gz && \
mv /elasticsearch-2.3.3 /usr/share/elasticsearch

#rm -f elasticsearch-2.3.3 && \

RUN chown -R elasticsearch:elasticsearch /usr/share/elasticsearch

#RUN chown -R elasticsearch:elasticsearch /vagrant

install curl and vim

#RUN apt-get update && apt-get install -y curl \

#vim

#Define mountable directories.

#VOLUME ["/vagrant/events/es/master-instance"]

WORKDIR /usr/share/elasticsearch

Mount elasticsearch.yml config

COPY config/logging.yml config/

#COPY config/elasticsearch.yml config/
COPY config/2/elasticsearch.yml config/

#COPY config/logging.yml /usr/share/elasticsearch/config/

#COPY config/elasticsearch.yml /usr/share/elasticsearch/config/

#ADD config/elasticsearch.yml /elasticsearch/config/elasticsearch.yml

Define working directory.

#WORKDIR /

Install HEAD plugin

#RUN /elasticsearch/bin/plugin -i mobz/elasticsearch-head

#Define default command.
USER elasticsearch
ENV PATH=$PATH:/usr/share/elasticsearch/bin
CMD ["elasticsearch"]

#CMD ["/elasticsearch/bin/elasticsearch"]

Expose ports.

#-9200: HTTP

#-9300: transport
EXPOSE 9200
EXPOSE 9300
EXPOSE 9201
EXPOSE 9301

#build docker image

#sudo docker build -t ashokmor/elasticsearch_322:1.1 .

#Create container

#docker run --rm -ti -p 9200:9200 -v esdata:/usr/share/elasticsearch/data --memory="4g" -e ES_HEAP_SIZE=2g my-es-image

#sudo docker run -d -p 9201:9201 -p 9301:9301 -v /usr/share/elasticsearch/config:/data <image> -Des.config=/data/elasticsearch.yml

#sudo docker run -d -p 9201:9201 -p 9301:9301 <image> -Des.config=/usr/share/elasticsearch/config/elasticsearch2.yml

#sudo docker run -d -p 9200:9200 -p 9300:9300 <image>

#sudo docker push -i ashokmor/myubuntubox:1.0

Docker Pull Command
Owner
ashokmor

Comments (0)