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. diff --git a/README.md b/README.md index 12a14b006da..6aea31b30a9 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,34 @@ ## 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 - ``` +```sh +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` 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