I have a Windows laptop with Docker Toolbox installed. So my backend services live in docker containers. Also, I have an Android Emulator with client application installed.
I know that I can get from Android Emulator to host's loopback by using 10.0.2.2 address. The problem is, that docker machine has its own address: 192.168.99.100 ( by default ).
How to make this work? Basically, I want to call 192.168.99.100:8080 from the Emulator. It is working well from Postman installed on Windows, but as far as I understand these are completely different networks, and this is the reason that it does not work out of the box.
Ok I found two solutions:
VirtualBox port forwarding
https://stackoverflow.com/a/36458215/5076865 -
After that you can access the docker app via 10.0.2.2:<your_port>
VirtualBox bridged adapter
Open docker-machine setting in VirtualBox and enable the 3rd network adapter and set it to the bridge mode. You should be able to access the docker app via 192.168.99.100:<your_port>
directly from emulator.
For me the second solution is better, because I have <your_port>
free on my docker host.