Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use v2.1.1 and added head plugin #56

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
37 changes: 14 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 `<data-dir>` on the host.

2. Create Elasticsearch config file at `<data-dir>/elasticsearch.yml`.

```yml
path:
logs: /data/log
data: /data/data
```
```sh
docker run -d -p 9200:9200 -p 9300:9300 -v "$PWD/data":/data <image_name> \
/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-dir>:/data dockerfile/elasticsearch /elasticsearch/bin/elasticsearch -Des.config=/data/elasticsearch.yml
```
After few seconds, open `http://<host>:9200` or run `curl http://<host>:9200/` to verify it is all good. Otherwise, check `<data-dir>/log/elasticsearch.log` file.

After few seconds, open `http://<host>:9200` to see the result.
HEAD plugin is available on address `http://<host>:9200/_plugin/head`
4 changes: 3 additions & 1 deletion config/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -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