As an alternative to the very famous ngrok I used to use efrecon/localtunnel
docker image to expose my http server on the internet for testing purposes.
With linux I used to:
- start my local HTTP server (let’s say on port 8080)
- start a container running the
efrecon/localtunnel
image with--network host
:docker run -it -d --name localtunnel --network host efrecon/localtunnel --port 8080
- fetch the provided URL:
export LOCAL_TUNNEL_URL=$(docker logs localtunnel | cut -d ' ' -f 4)
- et voilà:
curl $LOCAL_TUNNEL_URL/hello
Of course, with MacOs it’s not possible to use the --network=host
flag but I’m not finding the correct way to perform the same.
I tried multiple combinations like:
docker run -it -d --name localtunnel -p 8443:8080 efrecon/localtunnel --port 8080
curl $LOCAL_TUNNEL_URL:8443/hello
docker run -it -d --name localtunnel -p 443:8080 efrecon/localtunnel --port 8080
curl $LOCAL_TUNNEL_URL/hello
docker run -it -d --name localtunnel -p 80:8080 efrecon/localtunnel --port 8080
curl $LOCAL_TUNNEL_URL/hello
docker run -it -d --name localtunnel -p 9090:8080 efrecon/localtunnel --port 8080
curl $LOCAL_TUNNEL_URL:9090/hello
but none of them gave me results, only a dangling request waiting indefinitely to be achieved.
Any idea?