Elastic Search with Plugins in Docker

April 12 2020 · tech elasticsearch docker

A quick guide on running Elastic Search with plugins in Docker. This is ideal for running Elastic Search locally during development. All of the docs I’ve found on how to do this are out of date and no longer work.

The premise is simple. Create a local Docker image based on the official Elastic Search image, installing the Elastic Search plugins you require. Your Dockerfile will look something like the following, where ingest-attachment is whatever plugin you want to install.

FROM elasticsearch:7.6.2

RUN /usr/share/elasticsearch/bin/elasticsearch-plugin install --batch ingest-attachment

Build and save this as an image, using whatever tag name you want.

docker build -t elasticsearch-ingest-attachment .

Then for development you can spin up the image in a single node Elastic Search cluster

docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch-ingest-attachment

Confirm it’s up and running with

curl -GET "localhost:9200"

And you should get a response similar to

{
    "name" : "64adb598c086",
    "cluster_name" : "docker-cluster",
    "cluster_uuid" : "_jyHQb0LTeSIJxenN4MO1g",
    "version" : {
        "number" : "7.6.2",
        "build_flavor" : "default",
        "build_type" : "docker",
        "build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
        "build_date" : "2020-03-26T06:34:37.794943Z",
        "build_snapshot" : false,
        "lucene_version" : "8.4.0",
        "minimum_wire_compatibility_version" : "6.8.0",
        "minimum_index_compatibility_version" : "6.0.0-beta1"
    },
    "tagline" : "You Know, for Search"
}

Related Posts