How to "ionic cordova run" in Docker?

All the project is built in a docker container.

Now I need to develop on a real tablet device. So I connected with adb by wifi

adb connect 192.168.1.100:5555 // It works.

The problem is when I run:
ionic cordova run android -l --external

I get

Local: http://localhost:8100         // <= internal domain of the tablet
External: http://172.18.0.3:8100   // <= IP of my dev host

I asume the problem is that I run everything INSIDE a container within a docker network: 172.18.0.xxx
My dev machine IP is: 192.168.1.102

So the tablet try to connect into http://172.18.0.3:8100 which is NOT GOOD.
I get


But I don’t understand why the popup windows show: “(http://localhost:8100)”

How can I change the EXTERNAL IP?
I would like: External: http://192.168.1.102:8100

1 Like

Does anyone have any idea?

For those like me who need a custom domain. You need to change the host file of the device to point to
197.168.1.101 backend.test
** 197.168.1.101 api.backend.test**
With:
adb pull /system/etc/hosts /myfolder
Edit the file

 adb remount
 adb push /myfolder/hosts /system/etc/hosts

As for the ionic build…

ionic cordova platform rm android
cordova platform rm android
ionic cordova platform add android

You want to take a look at this post:

And this:

1 Like