How to install ElasticSeach plugins using docker compose

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

  image: elasticsearch
    - "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:

  • How to write variable in docker-compose, running multiple containers which uses the same image but their ports are different
  • Swarm: Manager in host + Worker in VM: No containers in workers
  • How to run docker with user namespace enabled?
  • How to get Container Id of Docker in Jenkins
  • Openshift : pods not being deleted
  • How to RUN plenv/rbenv in Dockerfile?
  • $ 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?

  • Kubernetes: how to use gitRepo volume?
  • docker entrypoint running bash script gets “permission denied”
  • Docker images wont run in background
  • Docker Compose for Rails
  • Compose: running a container that exits
  • Configure a user to access Parse Dashboard remotely
  • 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.