Ionic Capacitor Docker

I am developing an Ionic Capacitor app within a Docker container. I manage to create a container with its dependencies correctly.
Follow this tutorial: text

I am able to connect the Android device using adb so that it is detected from within the container.
Follow this tutorial: text

Great, I manage to run ionic cap run –external. This launches the webView at a URL (xxx.net), which works perfectly.

My issue arises when I try to use –livereload. Upon entering this command (ionic cap run –external), it launches the webView at the container’s IP address (e.g., 172.0.0.2) and returns ERR_ADDRESS_UNREACHABLE. When I run this command on my physical machine, it works perfectly.

So the issue seems to be a connection problem between the container and my physical machine (using that IP), as entering http://localhost:8100 in the browser resolves it, but http://172.0.0.2:8100 does not.

I’m not very familiar with Docker, I’ve tried initializing the container with docker run –network=”host”, docker run -p 8100:8100, and I’ve also attempted to ping when I launch the app. For example, I launch the app on my physical machine and ping from the Docker container, and it works, but the other way around doesn’t.

Sorry for my English level.

Regards.

I was hoping to use live reload in the App container. I’ve been able to achieve this with Ionic Cordova, but not with Capacitor.

The Capacitor Docs explains how to set up live reload: https://capacitorjs.com/docs/guides/live-reload

Leave a Comment