Official Repository

Last pushed: 2 days ago
Short Description
Elasticsearch is a powerful open source search and analytics engine that makes data easy to explore.
Full Description

Supported tags and respective Dockerfile links

For more information about this image and its history, please see the relevant manifest file (library/elasticsearch). This image is updated via pull requests to the docker-library/official-images GitHub repo.

For detailed information about the virtual/transfer sizes and individual layers of each of the above supported tags, please see the repos/elasticsearch/tag-details.md file in the docker-library/repo-info GitHub repo.

What is Elasticsearch?

Elasticsearch is a search server based on Lucene. It provides a distributed, multitenant-capable full-text search engine with a RESTful web interface and schema-free JSON documents.

Elasticsearch is a registered trademark of Elasticsearch BV.

wikipedia.org/wiki/Elasticsearch

How to use this image

Cluster

Note: since 5.0, Elasticsearch only listens on localhost by default on both http and transport, so this image sets http.host to 0.0.0.0 (given that localhost is not terribly useful in the Docker context).

As a result, this image does not support clustering out of the box and extra configuration must be set in order to support it.

Supporting clustering implies having Elasticsearch in a production mode which is more strict about the bootstrap checks that it performs, especially when checking the value of vm.max_map_count which is not namespaced and thus must be set to an acceptable value on the host (as opposed to simply using --sysctl on docker run).

One example of adding clustering support is to pass the configuration on the docker run:

$ docker run -d --name elas elasticsearch -Etransport.host=0.0.0.0 -Ediscovery.zen.minimum_master_nodes=1

See the following sections of the upstream documentation for more information:

This comment in elastic/elasticsearch#4978 shows why this change was added in upstream.

Elasticsearch will not start in production mode if vm.max_map_count is not high enough. [...] If the value on your system is NOT high enough, then your cluster is going to crash and burn at some stage and you will lose data.

Running Containers

You can run the default elasticsearch command simply:

$ docker run -d elasticsearch

You can also pass in additional flags to elasticsearch:

$ docker run -d elasticsearch -Des.node.name="TestNode"

This image comes with a default set of configuration files for elasticsearch, but if you want to provide your own set of configuration files, you can do so via a volume mounted at /usr/share/elasticsearch/config:

$ docker run -d -v "$PWD/config":/usr/share/elasticsearch/config elasticsearch

This image is configured with a volume at /usr/share/elasticsearch/data to hold the persisted index data. Use that path if you would like to keep the data in a mounted volume:

$ docker run -d -v "$PWD/esdata":/usr/share/elasticsearch/data elasticsearch

This image includes EXPOSE 9200 9300 (default http.port), so standard container linking will make it automatically available to the linked containers.

Image Variants

The elasticsearch images come in many flavors, each designed for a specific use case.

elasticsearch:<version>

This is the defacto image. If you are unsure about what your needs are, you probably want to use this one. It is designed to be used both as a throw away container (mount your source code and start the container to start your app), as well as the base to build other images off of.

elasticsearch:alpine

This image is based on the popular Alpine Linux project, available in the alpine official image. Alpine Linux is much smaller than most distribution base images (~5MB), and thus leads to much slimmer images in general.

This variant is highly recommended when final image size being as small as possible is desired. The main caveat to note is that it does use musl libc instead of glibc and friends, so certain software might run into issues depending on the depth of their libc requirements. However, most software doesn't have an issue with this, so this variant is usually a very safe choice. See this Hacker News comment thread for more discussion of the issues that might arise and some pro/con comparisons of using Alpine-based images.

To minimize image size, it's uncommon for additional related tools (such as git or bash) to be included in Alpine-based images. Using this image as a base, add the things you need in your own Dockerfile (see the alpine image description for examples of how to install packages if you are unfamiliar).

License

View license information for the software contained in this image.

Supported Docker versions

This image is officially supported on Docker version 1.13.1.

Support for older versions (down to 1.6) is provided on a best-effort basis.

Please see the Docker installation documentation for details on how to upgrade your Docker daemon.

User Feedback

Issues

If you have any problems with or questions about this image, please contact us through a GitHub issue. If the issue is related to a CVE, please check for a cve-tracker issue on the official-images repository first.

You can also reach many of the official image maintainers via the #docker-library IRC channel on Freenode.

Contributing

You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

Documentation

Documentation for this image is stored in the elasticsearch/ directory of the docker-library/docs GitHub repo. Be sure to familiarize yourself with the repository's README.md file before attempting a pull request.

Docker Pull Command

Comments (66)
cosminx
5 days ago

Did anyone figure out yet how to control heap size on the most recent versions (5+)?

apischan
18 days ago

If document say have the field:

{
    "somefield" : "/abc/def/ghi/"
}

and use filter in query with exactly the same string - document will not be found.
If I'm doing the same on elasticsearch (v. 2.4.4) installed locally - it works.
Problem with "/".

gpinkham
24 days ago

Anyone know how to get elastic started up and then run a second command to load some documents into the index?

carn1x
a month ago

-D option is no longer offered in 5.1.x, though examples don't make this clear.

colinlee
2 months ago

user -v "$PWD/config":/usr/share/elasticsearch/config, return

main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")

the config dir copy from elasticsearch(/usr/share/elasticsearch/config), how to fix?

ouya1998
2 months ago

hi ,how can I start 3 at least nods at one host,can I change the port when I start a new nod ?

sebesvn
2 months ago

Could we get an official 5.1.1-kibana tag with kibana included. Like rabbitmq which has a tag with the management plugin included. Or even better, a tag with the full ELK stack. Would be really nice.

zhukoff
2 months ago

@michaelox, to run/start elasticsearch image with installed x-pack plugin you also need to build your own custom image:

[root@dcoss1001 elasticsearch-xpack]# cat /Dockerfile/elasticsearch-xpack/Dockerfile
FROM elasticsearch:5.1.1
RUN bin/elasticsearch-plugin install x-pack --batch

Build it
docker build -t zhukov/elasticsearch-x-pack:5.1.1 /Dockerfile/elasticsearch-xpack

Ad run image as usual.

sebopl
2 months ago

Last images (elasticsearch:latest & elasticsearch:alpine) seems to have error:
$ docker run -v "$(mktemp -d)/esdata":/usr/share/elasticsearch/data elasticsearch
Unable to find image 'elasticsearch:latest' locally
latest: Pulling from library/elasticsearch
75a822cd7888: Pull complete
57de64c72267: Pull complete
cd1fc1696ecd: Pull complete
34836fffacad: Pull complete
4f4f57ee64ee: Pull complete
975b9daf71f5: Pull complete
6c6cde91351a: Pull complete
cda5a5d3e7b3: Pull complete
1c6134e30966: Pull complete
f9f0dc86ab9c: Pull complete
99c4c5cec031: Pull complete
0892d1f1b676: Pull complete
627538d3dc8c: Pull complete
9fd90f3d3e04: Pull complete
Digest: sha256:6588d00039bd3848b38a0a01a848da133e32826fac140519ae45b0954b1c7014
Status: Downloaded newer image for elasticsearch:latest
[2016-12-15T08:49:28,701][INFO ][o.e.n.Node ] [] initializing ...
[2016-12-15T08:49:28,997][INFO ][o.e.e.NodeEnvironment ] [XqRbxie] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/mapper/sda2_crypt)]], net usable_space [859.6gb], net total_space [908.9gb], spins? [possibly], types [ext4]
[2016-12-15T08:49:28,999][INFO ][o.e.e.NodeEnvironment ] [XqRbxie] heap size [1.9gb], compressed ordinary object pointers [true]
[2016-12-15T08:49:29,003][INFO ][o.e.n.Node ] node name [XqRbxie] derived from node ID [XqRbxieZSa2vdvxbGGQWVQ]; set [node.name] to override
[2016-12-15T08:49:29,010][INFO ][o.e.n.Node ] version[5.1.1], pid[1], build[5395e21/2016-12-06T12:36:15.409Z], OS[Linux/4.4.0-53-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_111/25.111-b14]
[2016-12-15T08:49:33,179][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [aggs-matrix-stats]
[2016-12-15T08:49:33,179][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [ingest-common]
[2016-12-15T08:49:33,180][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [lang-expression]
[2016-12-15T08:49:33,181][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [lang-groovy]
[2016-12-15T08:49:33,181][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [lang-mustache]
[2016-12-15T08:49:33,182][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [lang-painless]
[2016-12-15T08:49:33,184][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [percolator]
[2016-12-15T08:49:33,185][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [reindex]
[2016-12-15T08:49:33,186][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [transport-netty3]
[2016-12-15T08:49:33,186][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [transport-netty4]
[2016-12-15T08:49:33,188][INFO ][o.e.p.PluginsService ] [XqRbxie] no plugins loaded
[2016-12-15T08:49:33,804][WARN ][o.e.d.s.g.GroovyScriptEngineService] [groovy] scripts are deprecated, use [painless] scripts instead
[2016-12-15T08:49:41,164][INFO ][o.e.n.Node ] initialized
[2016-12-15T08:49:41,165][INFO ][o.e.n.Node ] [XqRbxie] starting ...
[2016-12-15T08:49:41,688][INFO ][o.e.t.TransportService ] [XqRbxie] publish_address {172.17.0.2:9300}, bound_addresses {[::]:9300}
[2016-12-15T08:49:41,715][INFO ][o.e.b.BootstrapCheck ] [XqRbxie] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2016-12-15T08:49:41,745][INFO ][o.e.n.Node ] [XqRbxie] stopping ...
[2016-12-15T08:49:41,820][INFO ][o.e.n.Node ] [XqRbxie] stopped
[2016-12-15T08:49:41,822][INFO ][o.e.n.Node ] [XqRbxie] closing ...
[2016-12-15T08:49:41,874][INFO ][o.e.n.Node ] [XqRbxie] closed

$ docker run -v "$(mktemp -d)/esdata":/usr/share/elasticsearch/data elasticsearch
Unable to find image 'elasticsearch:latest' locally
latest: Pulling from library/elasticsearch
75a822cd7888: Pull complete
57de64c72267: Pull complete
cd1fc1696ecd: Pull complete
34836fffacad: Pull complete
4f4f57ee64ee: Pull complete
975b9daf71f5: Pull complete
6c6cde91351a: Pull complete
cda5a5d3e7b3: Pull complete
1c6134e30966: Pull complete
f9f0dc86ab9c: Pull complete
99c4c5cec031: Pull complete
0892d1f1b676: Pull complete
627538d3dc8c: Pull complete
9fd90f3d3e04: Pull complete
Digest: sha256:6588d00039bd3848b38a0a01a848da133e32826fac140519ae45b0954b1c7014
Status: Downloaded newer image for elasticsearch:latest
[2016-12-15T08:49:28,701][INFO ][o.e.n.Node ] [] initializing ...
[2016-12-15T08:49:28,997][INFO ][o.e.e.NodeEnvironment ] [XqRbxie] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/mapper/sda2_crypt)]], net usable_space [859.6gb], net total_space [908.9gb], spins? [possibly], types [ext4]
[2016-12-15T08:49:28,999][INFO ][o.e.e.NodeEnvironment ] [XqRbxie] heap size [1.9gb], compressed ordinary object pointers [true]
[2016-12-15T08:49:29,003][INFO ][o.e.n.Node ] node name [XqRbxie] derived from node ID [XqRbxieZSa2vdvxbGGQWVQ]; set [node.name] to override
[2016-12-15T08:49:29,010][INFO ][o.e.n.Node ] version[5.1.1], pid[1], build[5395e21/2016-12-06T12:36:15.409Z], OS[Linux/4.4.0-53-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_111/25.111-b14]
[2016-12-15T08:49:33,179][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [aggs-matrix-stats]
[2016-12-15T08:49:33,179][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [ingest-common]
[2016-12-15T08:49:33,180][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [lang-expression]
[2016-12-15T08:49:33,181][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [lang-groovy]
[2016-12-15T08:49:33,181][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [lang-mustache]
[2016-12-15T08:49:33,182][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [lang-painless]
[2016-12-15T08:49:33,184][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [percolator]
[2016-12-15T08:49:33,185][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [reindex]
[2016-12-15T08:49:33,186][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [transport-netty3]
[2016-12-15T08:49:33,186][INFO ][o.e.p.PluginsService ] [XqRbxie] loaded module [transport-netty4]
[2016-12-15T08:49:33,188][INFO ][o.e.p.PluginsService ] [XqRbxie] no plugins loaded
[2016-12-15T08:49:33,804][WARN ][o.e.d.s.g.GroovyScriptEngineService] [groovy] scripts are deprecated, use [painless] scripts instead
[2016-12-15T08:49:41,164][INFO ][o.e.n.Node ] initialized
[2016-12-15T08:49:41,165][INFO ][o.e.n.Node ] [XqRbxie] starting ...
[2016-12-15T08:49:41,688][INFO ][o.e.t.TransportService ] [XqRbxie] publish_address {172.17.0.2:9300}, bound_addresses {[::]:9300}
[2016-12-15T08:49:41,715][INFO ][o.e.b.BootstrapCheck ] [XqRbxie] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2016-12-15T08:49:41,745][INFO ][o.e.n.Node ] [XqRbxie] stopping ...
[2016-12-15T08:49:41,820][INFO ][o.e.n.Node ] [XqRbxie] stopped
[2016-12-15T08:49:41,822][INFO ][o.e.n.Node ] [XqRbxie] closing ...
[2016-12-15T08:49:41,874][INFO ][o.e.n.Node ] [XqRbxie] closed

mihamarkic
2 months ago

Just a headsup that elasticsearch.yml configuration file has to be in /usr/share/elasticsearch/config directory. The existing one in /etc/elasticsearch isn't used at all and it is ignored. Goes for 1.7.x, not sure about the other versions.