is it possible to get the docker host IP inside the java program running in the docker container?
Asked
Active
Viewed 1,699 times
0
-
Hi, welcome to stack overflow. Please refer the [ask] link for more details on how to ask a question and update your question accordingly. – Jeroen Heier Apr 18 '18 at 03: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 Apr 18 '18 at 03:55
1 Answers
1
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

Codetector
- 694
- 6
- 16