Description
Self-hosted Telegram Bot API (telegram-bot-api Docker image) needs to connect to Telegram servers. In regions where Telegram is blocked, it needs proxy support.
Options
- proxychains in Docker — wrap
telegram-bot-api binary with proxychains4 configured to use host SOCKS5 proxy
- tun2socks — create a tun device that routes all traffic through SOCKS5
- Docker network with Tor — add Tor container, route Bot API traffic through it
- iptables + redsocks — transparent proxy at network level
Simplest approach
Option 1: Add proxychains to Dockerfile, configure via environment variable.
FROM aiogram/telegram-bot-api:latest
RUN apk add --no-cache proxychains-ng
COPY proxychains.conf /etc/proxychains.conf
ENTRYPOINT ["proxychains4", "telegram-bot-api"]
Config needed
PROXY_HOST and PROXY_PORT environment variables
proxychains.conf template with substitution
Description
Self-hosted Telegram Bot API (
telegram-bot-apiDocker image) needs to connect to Telegram servers. In regions where Telegram is blocked, it needs proxy support.Options
telegram-bot-apibinary with proxychains4 configured to use host SOCKS5 proxySimplest approach
Option 1: Add proxychains to Dockerfile, configure via environment variable.
Config needed
PROXY_HOSTandPROXY_PORTenvironment variablesproxychains.conftemplate with substitution