From 8153f7fb92511b5ebbaff5bc0549d5984e692658 Mon Sep 17 00:00:00 2001 From: Marin Bek Date: Fri, 8 Jan 2016 14:37:28 +0100 Subject: [PATCH 1/5] define scripts location, allow scripts --- config/elasticsearch.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/elasticsearch.yml b/config/elasticsearch.yml index 72be0f9690f..5353b09ac29 100644 --- a/config/elasticsearch.yml +++ b/config/elasticsearch.yml @@ -1,5 +1,7 @@ path: data: /data/data logs: /data/log - plugins: /data/plugins work: /data/work + scripts: /data/scripts +script.inline: on +script.indexed: on From 600a3670f8569d53b476582b3242f9ae6e394123 Mon Sep 17 00:00:00 2001 From: Marin Bek Date: Fri, 8 Jan 2016 14:37:53 +0100 Subject: [PATCH 2/5] install v2.1.1, run with dedicated user, add head plugin --- Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index ade04c56777..b7571d65909 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,28 +5,28 @@ # # Pull base image. -FROM dockerfile/java:oracle-java8 +FROM java:7 -ENV ES_PKG_NAME elasticsearch-1.5.0 +ENV ES_PKG_NAME elasticsearch-2.1.1 # Install Elasticsearch. RUN \ - cd / && \ - wget https://download.elasticsearch.org/elasticsearch/elasticsearch/$ES_PKG_NAME.tar.gz && \ - tar xvzf $ES_PKG_NAME.tar.gz && \ - rm -f $ES_PKG_NAME.tar.gz && \ - mv /$ES_PKG_NAME /elasticsearch + cd / && \ + wget https://download.elasticsearch.org/elasticsearch/elasticsearch/$ES_PKG_NAME.tar.gz && \ + tar xf $ES_PKG_NAME.tar.gz && \ + mv $ES_PKG_NAME elasticsearch && \ + /elasticsearch/bin/plugin install mobz/elasticsearch-head -# Define mountable directories. VOLUME ["/data"] # Mount elasticsearch.yml config ADD config/elasticsearch.yml /elasticsearch/config/elasticsearch.yml -# Define working directory. WORKDIR /data # Define default command. +RUN useradd -ms /bin/bash es +USER es CMD ["/elasticsearch/bin/elasticsearch"] # Expose ports. From 85ae9ac573171277d4b1e4ff8fe48d206aae185b Mon Sep 17 00:00:00 2001 From: Marin Bek Date: Fri, 8 Jan 2016 14:44:23 +0100 Subject: [PATCH 3/5] readme update --- README.md | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 12a14b006da..e99d63845c3 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,33 @@ ## Elasticsearch Dockerfile -This repository contains **Dockerfile** of [Elasticsearch](http://www.elasticsearch.org/) for [Docker](https://www.docker.com/)'s [automated build](https://registry.hub.docker.com/u/dockerfile/elasticsearch/) published to the public [Docker Hub Registry](https://registry.hub.docker.com/). +This repository contains **Dockerfile** of [Elasticsearch v2.1.1](http://www.elasticsearch.org/) for [Docker](https://www.docker.com/) including some helpful plugin(s). + +## Plugins included +- `mobz/elasticsearch-head` ### Base Docker Image -* [dockerfile/java:oracle-java8](http://dockerfile.github.io/#/java) +* [dockerfile/java:7](http://dockerfile.github.io/#/java) ### Installation 1. Install [Docker](https://www.docker.com/). -2. Download [automated build](https://registry.hub.docker.com/u/dockerfile/elasticsearch/) from public [Docker Hub Registry](https://registry.hub.docker.com/): `docker pull dockerfile/elasticsearch` - - (alternatively, you can build an image from Dockerfile: `docker build -t="dockerfile/elasticsearch" github.com/dockerfile/elasticsearch`) +2. Build image from Dockerfile, from directory containing `Dockerfile`: + - `docker build -t "some_image_name" .` ### Usage - docker run -d -p 9200:9200 -p 9300:9300 dockerfile/elasticsearch - -#### Attach persistent/shared directories - - 1. Create a mountable data directory `` on the host. - - 2. Create Elasticsearch config file at `/elasticsearch.yml`. - - ```yml - path: - logs: /data/log - data: /data/data - ``` + ``` + docker run -d -p 9200:9200 -p 9300:9300 -v "$PWD/data":/data /elasticsearch/bin/elasticsearch -Des.network.host=::0 + ``` - 3. Start a container by mounting data directory and specifying the custom configuration file: +Above command will automatically create `data` directory in folder where you run it. If you want to have `data` in some other directory, change the part `$PWD/data` to desired path. - ```sh - docker run -d -p 9200:9200 -p 9300:9300 -v :/data dockerfile/elasticsearch /elasticsearch/bin/elasticsearch -Des.config=/data/elasticsearch.yml - ``` +After few seconds, open `http://:9200` or run `curl http://:9200/` to verify it is all good. Otherwise, check `/log/elasticsearch.log` file. -After few seconds, open `http://:9200` to see the result. +HEAD plugin is available on address `http://:9200/_plugin/head` From 69a4e3f67557a7391946abeb3e9011bbe399a3e9 Mon Sep 17 00:00:00 2001 From: Marin Bek Date: Fri, 8 Jan 2016 14:49:45 +0100 Subject: [PATCH 4/5] shell run --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e99d63845c3..0ad7e6da4b1 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,9 @@ This repository contains **Dockerfile** of [Elasticsearch v2.1.1](http://www.ela ### Usage - ``` - docker run -d -p 9200:9200 -p 9300:9300 -v "$PWD/data":/data /elasticsearch/bin/elasticsearch -Des.network.host=::0 - ``` +```sh +docker run -d -p 9200:9200 -p 9300:9300 -v "$PWD/data":/data /elasticsearch/bin/elasticsearch -Des.network.host=::0 +``` Above command will automatically create `data` directory in folder where you run it. If you want to have `data` in some other directory, change the part `$PWD/data` to desired path. From 984a34718c85daf6d22e337263af3e707a2ef5ec Mon Sep 17 00:00:00 2001 From: Marin Bek Date: Fri, 8 Jan 2016 14:50:41 +0100 Subject: [PATCH 5/5] multiline readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0ad7e6da4b1..6aea31b30a9 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ This repository contains **Dockerfile** of [Elasticsearch v2.1.1](http://www.ela ### Usage ```sh -docker run -d -p 9200:9200 -p 9300:9300 -v "$PWD/data":/data /elasticsearch/bin/elasticsearch -Des.network.host=::0 +docker run -d -p 9200:9200 -p 9300:9300 -v "$PWD/data":/data \ + /elasticsearch/bin/elasticsearch -Des.network.host=::0 ``` Above command will automatically create `data` directory in folder where you run it. If you want to have `data` in some other directory, change the part `$PWD/data` to desired path.