Install elasticsearch in a running docker container

There is a lot of documentation on installing ELK using dockers e.g. https://github.com/deviantony/docker-elk

However, I want to install ELK in a running docker container.

  1. I followed the instructions here
    https://www.elastic.co/guide/en/elasticsearch/reference/current/targz.html to install elasticsearch in a running container

  2. I got an error - [ java.lang.RuntimeException: can not run elasticsearch as root]. I followed instructions here to solve this. https://stackoverflow.com/questions/34920801/how-to-run-elasticsearch-2-1-1-as-root-user-in-linux-machine.

  3. Now, I am getting this error -
    main ERROR Could not register mbeans java.security.AccessControlException: access denied ("javax.management.MBeanTrustPermission" "register")
    at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)

How to resolve this?

Is there a reason you cannot use the existing containers that have Elasticsearch already installed?

I already have a container running with some other deep learning packages. I want to use elasticsearch for data pre-processing steps.