简体   繁体   中英

Docker host IP inside java program running in the container

是否有可能在docker容器中运行的java程序中获取docker主机IP?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM