Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Ngrok in a container using docker

Tags:

docker

ngrok

[https://github.com/gtriggiano/ngrok-tunnel ] runs ngrok inside a container. Ngrok is required to run in the container to avert security risks. But am facing problems after running the scripts, which generates the url

$ docker pull gtriggiano/ngrok-tunnel


$ docker run -it  -e "TARGET_HOST=localhost" -e "TARGET_PORT=3000" -p 4040 gtriggiano/ngrok-tunnel

enter image description here am running my rails app on localhost:3000

is it my problem or can it be fixed by altering the scripts(inside the repo)?

like image 510
Adwaith R Krishna Avatar asked Dec 04 '18 12:12

Adwaith R Krishna


1 Answers

I couldn't get this working but switched to https://github.com/shkoliar/docker-ngrok and it works brilliantly.

In my case I added it to my docker-compose.yml file:

ngrok:
    image: shkoliar/ngrok:latest
    ports:
      - 4551:4551
    links:
      - web
    environment:
      - PARAMS=http -region=eu -authtoken=${NGROK_AUTH_TOKEN} localdev.docker:80
    networks:
      dev_net:
        ipv4_address: 10.5.0.10

And it's started with everything else when I do docker-compose up -d

Then there's a web UI at http://localhost:4551/ for you to see the status, requests, the ngrok URLs, etc.

The Github page does have examples of running it manually from the command line too though, rather than via docker-compose:

Command-line Example The example below assumes that you have running web server docker container named dev_web_1 with exposed port 80.

docker run --rm -it --link dev_web_1 shkoliar/ngrok ngrok http dev_web_1:80

With command line usage, ngrok session is active until it won't be terminated by Ctrl+C combination.

like image 148
BT643 Avatar answered Sep 21 '22 00:09

BT643