DEV Community

Kirill Bobykin
Kirill Bobykin

Posted on

4 2

Easy local tunnel with docker environment

Why?

  • You can provide demo for your web application from development environment
  • You can use domain and https connection for test purposes
  • It is pretty easy to setup

How?

Try to use tunnel services like ngrok, localtunnel, etc...

You can check it with docker-compose. Setup docker-compose.yml, for example:

# docker-compose.yml
version: '3.8'

services:
  server:
    image: nginxdemos/hello
    ports: 
      - 80

  localtunnel:
    image: efrecon/localtunnel
    restart: on-failure
    command:
      --local-host server --port 80 --subdomain $SUBDOMAIN
    environment: 
      - SUBDOMAIN=megauniquedomain
    links:
      - server
    depends_on:
      - server
Enter fullscreen mode Exit fullscreen mode

Run this config with docker-compose up -d
Then check https://megauniquedomain.loca.lt/ you will meet your server root page.

How does it work?

I found great answer on stackoverflow for you!

Billboard image

Synthetic monitoring. Built for developers.

Join Vercel, Render, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (3)

Collapse
 
chan_austria777 profile image
chan 🤖

If i set this up, and run this, can i run it on different machines and use the same subdomain for all without conflicting?

I'm kinda thinking that it's like 1 to 1 mapping. 1 localtunnel client to 1 localtunnel server in Docker.

Collapse
 
qelphybox profile image
Kirill Bobykin

only if you not run two tunnels on one subdomain simultaneously

Collapse
 
mikhailbystrov profile image
Misha

Thanks!

Billboard image

Imagine monitoring that's actually built for developers

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay