I am running Docker container which runs a jar file inside it.
This jar file need an access to Elasticsearch for reading data and this Elasticsearch service is installed on the local machine (Not in Docker Container)
I need to connect to local Elasticsearch service from Docker container to make it work
I wrote EXPOSE 9200 9300 service-port in Dockerfile and my Docker run command is as follows,
"docker run -itd --memory=1g -p 9300:9300 -p 9200:9200 -p service-port:service-port --name service-name service-name -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=2 -XshowSettings:vm"
and when I run this command I get following error,
"docker: Error response from daemon: driver failed programming external connectivity on endpoint service-name (3de884dd9a62a4a989475721cc4cdf9cb6b78f1a8d345e590471d85052d6a4de): Error starting userland proxy: listen tcp 0.0.0.0:9300: bind: address already in use."
P.S = On my Local server I need to keep elasticsearch service ON