Running TG WS Proxy inside Docker is the recommended approach for server-side or headless deployments. The container exposes the proxy on portDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Flowseal/tg-ws-proxy/llms.txt
Use this file to discover all available pages before exploring further.
1443, restarts automatically on failure, and is fully configured through environment variables — no config files to manage.
Setup
Run the container
-d flag runs the container in detached mode. --restart=always ensures it comes back up automatically after a reboot or crash.Environment Variables
All proxy settings are passed as environment variables at container start time:| Variable | Default | Description |
|---|---|---|
TG_WS_PROXY_HOST | 0.0.0.0 | Interface address the proxy listens on inside the container |
TG_WS_PROXY_PORT | 1443 | Port the proxy listens on inside the container |
TG_WS_PROXY_SECRET | "" (empty) | 32-character hex secret used to authenticate clients; auto-generated when empty |
TG_WS_PROXY_DC_IPS | 2:149.154.167.220 4:149.154.167.220 | Space-separated list of DC:IP pairs the proxy will forward traffic to |
Custom Secret
It is good practice to set a fixed secret so the connection link stays stable across container restarts. Generate one with:Connect Telegram Desktop
Because the proxy is running on a remote host (or on a separate Docker network), the Server address in Telegram Desktop must be the IP or hostname of the Docker host — not127.0.0.1.
Open Telegram proxy settings
In Telegram Desktop go to Settings → Advanced → Connection type, then select Use custom proxy.
Add a new proxy
Click Add proxy and fill in the fields:
- Type: MTProto
- Server: your Docker host’s public IP or hostname (e.g.
203.0.113.10) - Port:
1443(or the host-side port from-p) - Secret: the value of
TG_WS_PROXY_SECRETfrom the logs
The Dockerfile uses
python:3.12-slim as the runtime base image and installs tini as the container init process. Tini ensures that the proxy receives Unix signals correctly (e.g. SIGTERM on docker stop) and that zombie processes are properly reaped, making the container behave predictably in orchestrated environments.