A public IP for a Docker host behind CGNAT: one address, many apps (tested)
If your internet provider shares one address between many customers (CGNAT), or your router will not forward ports, nothing from outside can reach your Docker host. This page gives the whole host one public address. Several apps share it behind one front door, a reverse proxy on port 80, and everything comes back by itself after a reboot.
For a single container and the basics, start with Expose a Docker container without port forwarding.
Tested on
Date: 18 November 2026 · Host: Debian 12, Docker Engine 29.10.0 and Docker Compose v5.8.0, a test virtual machine in our lab behind a NAT router with no port forwarding. This is not carrier CGNAT, but inbound behaves the same: nothing from outside gets in. · On the real service: the normal TunnelNet installer, on an internal test account · The visitor: a test machine in Atlanta · Images: caddy:2-alpine (the front door) and nginx:1.27-alpine (two apps).
Not tested: https on port 443 with a real domain and certificate, carrier CGNAT itself, IPv6 (tnet status showed IPv6: none on this test device), the $20 plan's outgoing traffic through the address, and moving the stack to another machine. The address is 203.0.113.47, a documentation example.
Before
From a machine on another network, a published container on the home line's own address does not answer: http 000, timed out after 8 seconds.
1. Install TunnelNet on the host
Run the command from your TunnelNet dashboard:
Enrolled!
Public IP: 203.0.113.47
$ sudo tnet ports
Mode: filtered
(no rules)
Nothing is reachable yet. The install itself is shown step by step in the single-container guide above.
2. One front door, two apps
The Caddyfile:
:80 {
handle_path /a/* {
reverse_proxy app-a:80
}
handle_path /b/* {
reverse_proxy app-b:80
}
respond "front door" 200
}
The compose.yaml:
services:
proxy:
image: caddy:2-alpine
restart: unless-stopped
ports:
- "80:80"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
app-a:
image: nginx:1.27-alpine
restart: unless-stopped
volumes:
- ./a:/usr/share/nginx/html:ro
app-b:
image: nginx:1.27-alpine
restart: unless-stopped
volumes:
- ./b:/usr/share/nginx/html:ro
$ sudo docker compose up -d
Container stack-proxy-1 Started
Container stack-app-a-1 Started
Container stack-app-b-1 Started
$ curl -s http://127.0.0.1/a/
app A
Only the front door publishes a port. The apps are reachable only through it.
Undo: sudo docker compose down.
3. Open the front door's port
$ sudo tnet ports allow tcp 80 --note=front-door
Allowed tcp 80
From the outside machine:
03:05:09 visitor -> 203.0.113.47/ : front door (56 s after allow)
03:05:09 visitor -> 203.0.113.47/a/ : app A
03:05:10 visitor -> 203.0.113.47/b/ : app B
In our runs a newly allowed port started answering after 1, 9 and 56 seconds. Wait a minute before deciding it does not work.
Undo: step 5.
4. Reboot the host
$ sudo reboot
03:05:56 visitor -> 203.0.113.47/ after reboot: front door (44 s after the reboot command)
$ sudo tnet status
Tunnel: UP
Public IP: 203.0.113.47
Handshake: 14s ago
$ systemctl is-enabled wg-quick@wg0
enabled
The tunnel starts at boot, and Docker brings the containers back because of restart: unless-stopped. The address and the open ports stayed the same, and nothing had to be done by hand.
5. Close it
$ sudo tnet ports deny 80
Denied port 80
It stopped answering 13 seconds later.
Good to know
- One address, many apps. Put a reverse proxy on port 80 (and 443) and send each app by path or by name. That saves opening a port per app and is easier to keep safe.
- Other ports stay closed until you run
tnet ports allow. On this host, ports 8080, 8081 and 22 never answered from outside unless allowed. - Outgoing traffic. On the $10 plan, the host's own browsing still uses your home line. Only incoming connections use the TunnelNet address.
- https. Caddy can get a certificate by itself once your domain points at the address. We did not run that here.
- The address belongs to the TunnelNet device. Moving the stack to another machine means installing TunnelNet there. We did not test that.
Limits
- 1 TB a month included, then 10 Mbit/s until the 1st of the month (an extra 1 TB costs $15).
- Outgoing mail on port 25 is blocked.
- Your apps see visitors as coming from TunnelNet, not from the visitor's own address.