is it possible to get the docker host IP inside the java program running in the docker container?
-
Hi, welcome to stack overflow. Please refer the How to Ask link for more details on how to ask a question and update your question accordingly.Jeroen Heier– Jeroen Heier2018-04-18 03:52:02 +00:00Commented Apr 18, 2018 at 3:52
-
@JeroenHeier The question sounds a bit like an X-Y problem, but other than that I don't think there is anything wrong with it.Henry– Henry2018-04-18 03:55:44 +00:00Commented Apr 18, 2018 at 3:55
Add a comment
|
1 Answer
From my understanding that docket from it’s initial design is to isolate the host from containers. Although this is doable, such as passing in a env variable to the container at startup, it is not a good practice. Try to containerize everything, and use a network and network links instead. [Docker Compose maybe helpful]
If you really need to do so for whatever reason here is a link for reference
How to get the IP address of the docker host from inside a docker container