How to install ElasticSeach plugins using docker compose

I have a docker-compose.yml file with an elastic search image:

elasticsearch:
  image: elasticsearch
  ports:
    - "9200:9200"
  container_name: custom_elasticsearch_1

If I want to install additional plugins like the HQ interface or the attachment-mapper I have to do a manual installation with the following commands:

  • Is it possible to modify docker run option without removing and recreating the container?
  • cannot connect to cassandra docker with cqlsh
  • Multi-Node Hadoop in kubernetes
  • How to create docker containers with the same internal IP address?
  • when doing docker compose, is it possible to keep previous docker composition
  • CORS error upload file ~4mb
  • $ docker exec custom_elasticsearch_1 plugin install royrusso/elasticsearch-HQ
    $ docker exec custom_elasticsearch_1 plugin install mapper-attachments
    

    Is there a way to install them automatically when I run the docker-compose up command?

  • how to create compatible certificates for docker (Azure Linux vm) from OSX
  • Dockerfile run /bin/bash id ENTRYPOINT or CMD fails
  • Is it redundant in a Dockfile to run USER root since you're already root?
  • Unable to connect to socket server running inside docker container
  • Exception occuring when updating database schema in symfony
  • how to create a volume in docker with filesystem?
  • One Solution collect form web for “How to install ElasticSeach plugins using docker compose”

    Here is a blog post by Elastic pertaining to exactly that! You need to use a Dockerfile which executes commands to extend an image. Your Dockerfile will look something like this:

    FROM custom_elasticsearch_1
    
    RUN plugin install royrusso/elasticsearch-HQ
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.