I have BrowserMobProxy realization in the project. This logic uses the IP address for Proxy connection and test UI web-service (Proxy used for request/response statistic saving). All worked fine before, but we restart docker and the IP address for the proxy was changed. Now I need to found a new IP address for the proxy.
Code where IP address used
public static void startProxyServer(String address) {//address = "172.17.0.2"
if (browserMobProxy.isStarted()) {
browserMobProxy.stop();
}
try {
browserMobProxy.start(9090, Inet4Address.getByName(address)); // {1}
useExclusivePort = browserMobProxy.getPort();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
After docker was restarting the project began fails on the line {1}.
I started the search for new IP on the server. Unfortunately, I can't use ifconfig command from the docker image since this command does not install there. So I determined the address from the server in the following way:
After I use IP 172.17.0.2 the code works well and I hoped I resolved this issue, but as it turned out I lost connection with this proxy - on the UI I got the following result:
So I totally confused:
- All works well before the docker image was restarted
- Old IP looks like 172.19.0.5 but the code fails with it now.
- I "found" new IP 172.17.0.2 and code work with it.
- I not sure I determined correct IP since all old IP was started with 172.19.0.{4,5,8}
- I have no connection with the new IP
- I do not know or I found the correct IP and why it suitable for code but not suitable for connection
- The project deploys with Jenkins docker image. Browsers start on the selenium grid
#Question:
How do I need to found the correct IP that I can use for a proxy connection?

