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:

  • Docker port not visible
  • WordPress Docker Proxy Error 502 : The proxy server received an invalid response from an upstream server
  • AWS cloud form task definition conditional command
  • Windows server 2008 base image for docker
  • Should you install nginx inside docker? [closed]
  • Were are the docker Remote API logs stored?
  • $ 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?

  • Running rabbitmqadmin in docker fails
  • Permissions error running Java Timezone Updater JAR in Dockerfile
  • Why is SSH from inside docker container to other instance/server so slow
  • Docker 1.13 stack deploy with global service malfunction (target replicas increase without limit)
  • Docker + MongoDB: How to view database with RoboMongo?
  • Routing based on path in Dokku
  • 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.