Docker

You can use LocalXpose docker version the same way as LocalXpose CLI. Check the availabe commands here.

Usage

docker run -it -e ACCESS_TOKEN=YOUR_TOKEN_HERE \
    localxpose/localxpose:latest <COMMAND> <SUBCOMMAND> <FLAG>

- Run http tunnel

docker run -it -e ACCESS_TOKEN=YOUR_TOKEN_HERE \
    localxpose/localxpose:latest tunnel http

since docker container has its own network, you cannot forward connections to localhost services like --to localhost:8080, localhost here is pointing to your LocalXpose docker container not to your host, to forward the traffic to your host network then get your host local IP address for exmaple 192.168.100.10, then do docker run -it localxpose/localxpose:latest tunnel http --to 192.168.100.10:8080.

Another approach is to run LocalXpose docker container in your host network by passing --net host to your docker run command, so the full command will be:

docker run --net host -it -e ACCESS_TOKEN=YOUR_TOKEN_HERE \
    localxpose/localxpose:latest tunnel http --to localhost:8080

- Run mutliple tunnels from config.yaml

First create your config.yaml file, then you have to mount it inside LocalXpose docker container, for example if we have the following config.yaml file:

dev:
 type: http
 to: 192.168.100.2:8080
 subdomain: dockerdo

Then mounting this config file to your LocalXpose conitaner and running the tunnels will be like:

docker run -it -e ACCESS_TOKEN=YOUR_TOKEN_HERE \
    -v /home/username/config.yaml:/config.yaml \
    localxpose/localxpose:latest tunnel config -f /config.yaml

© xLab 2023. All Rights Reserved