You can expose a local service to public using ngrok.
Follow instructions in the
official documentation of ngrok
to setup ngrok.
Install ngrok.
sudo snap install ngrokLogin to ngrok.com to identify your ngrok token.
Connect your account following instructions.
ngrok config add-authtoken your_tokenStart a http tunnel forwarding to you local port.
ngrok http your_choice_of_port
For example, suppose you have launch a code-server service in your local network using the following command.
docker run -d --init \
--hostname vscode-server \
--log-opt max-size=50m \
--memory=$(($(head -n 1 /proc/meminfo | awk '{print $2}') * 4 / 5))k \
--cpus=$(($(nproc) - 1)) \
-p 2020:8080 \
-e DOCKER_USER=$(id -un) \
-e DOCKER_USER_ID=$(id -u) \
-e DOCKER_PASSWORD=$(id -un) \
-e DOCKER_GROUP_ID=$(id -g) \
-v "$(pwd)":/workdir \
dclong/vscode-server /scripts/sys/init.shYou can expose it to public via ngrok by running the following command.
ngrok http 2020