Hi there.
I have a use case where I need to dynamically add TCP proxies to external hosts.
I am running 3.6 in docker and use file provider.
For my HTTP(s) connections I use dynamic files and that works easily using a simple API and some jinja.
However for the TCP I need to be able to create a TCP proxy to an external ip. The connections will be either RDP, SSH or gRPC. Because I do not know when I start Traefik how many of each type, could be zero could be 300 or what the destination is I need to do this programatically.
e.g.
host1.mysite.com –> 10.21.2.50:22
host2mysite.com –> 10.22.2.50:22
or RDP
rdp.mysite.com –> 10.21.2.50:3389
I am a little, quite a little (very) confused on how to make this work. Any nudges would be greatly appreciated.
My docker-compose looks like:
``` yaml
services:
traefik:
image: traefik:v3.6
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
- proxy
ports:
- "80:80"
- "443:443"
- "5500:5500"
- "2222:2222"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./certs:/certs
- ./dynamic:/dynamic:ro
command:
- "--entrypoints.web.address=:80"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.web.http.redirections.entrypoint.permanent=true"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.websecure.http.tls=true"
- "--entrypoints.ssh.address=:2222"
# Providers
- "--providers.file.directory=/dynamic"
- "--providers.file.watch=true"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--providers.docker.network=proxy"
# API & Dashboard
- "--api.dashboard=true"
- "--api.insecure=false"
# Lets Encrypt
environment:
- CF_DNS_API_TOKEN=
# Traefik Dynamic configuration via Docker labels
labels:
# Enable self‑routing
- "traefik.enable=true"
networks:
proxy:
name: proxy
external: true
```