localtunnel.me with docker-compose
For local development, you find yourself having to deal with webhooks, authorization callbacks etc, anything that requires public facing IP or sometimes a public domain. You can use ngrok or localtunnel.
For this quick writeup, I’m going to show you how I manage to include localtunnel.me in my docker-compose.yml
so that it loads everytime I run my docker-compose.
First I create a folder inside my project called lt
, you can name it whatever you want but make sure to take note of the folder name because you are going to need that in your docker-compose.yml
file. Inside that folder I drop in a Dockerfile
with the following contents.
Then in my docker-compose.yml
file I’ve added the following contents.
You will notice that I pass the --local-host web
in the lt
options, this will ensure that you are forwarding the requests to the web
service in your docker-compose.yml
. You can also pass --subdomain yoursubdomain
if you want to keep it consistent, but take note that it may not be available.
To get the url
you can just run: docker-compose logs -f lt
and this will give you something like https://<random_subdomain>.localtunnel.me
which you can use for your webhooks, callbacks, etc.