how use ngrok running inside docker

Posted: [Source]
Tags:  development docker localhost ngrok

If you wish use ngrok, but dont want to install another system app, you can run it using docker.

Steps

  1. go to: https://dashboard.ngrok.com/get-started/your-authtoken

  2. copy the auth token

  3. run the below command line with the appropriate <TOKEN> (from the above step) and <PORT> of the running app:

    docker run -it -e NGROK_AUTHTOKEN=<TOKEN> --add-host=host.docker.internal:host-gateway ngrok/ngrok http host.docker.internal:<PORT>

    please note that you should add host.docker.internal and use it instead of 127.0.0.1 or localhost for your host

  4. copy the provided url and share your app