MTProxy from Telegram source. Runtime image.
330
Docker image for MTProxy (Telegram MTProto proxy), built from the official TelegramMessenger/MTProxy source. Runtime-only image — no compilation inside the container.
docker run -d -p 443:443 \
-v mtproxy-data:/data \
-e SECRET=your_32_hex_char_secret \
-e TAG=your_32_hex_tag \
aleksandrborodavkin/mtproxy:0.02
| Variable | Required | Description |
|---|---|---|
SECRET | Yes | 32 hex characters (16 bytes). Generate: head -c 16 /dev/urandom | xxd -ps |
TAG | No | 32 hex proxy tag from @MTProxybot |
WORKERS | No | Number of workers (default: 2) |
# MTProto Proxy
SECRET=your_32_hex_char_secret_here
TAG=your_32_hex_tag_from_mtproxybot
WORKERS=2
Use your own values: generate SECRET with head -c 16 /dev/urandom | xxd -ps, get TAG from @MTProxybot after registering the proxy.
proxy-secret, proxy-multi.conf). Fetched from Telegram on first run if missing.services:
mtproxy:
image: aleksandrborodavkin/mtproxy:0.02
restart: always
ports:
- "443:443"
volumes:
- proxy-config:/data
env_file:
- .env
volumes:
proxy-config:
Create a .env file in the same directory (see Example .env above).
Binary is built from source on the host; the image only adds runtime and entrypoint (no build inside Docker).
Runtime base image: debian:trixie-slim (glibc ≥ 2.38, currently 2.41).
1. Build MTProxy binary:
git clone https://github.com/TelegramMessenger/MTProxy
cd MTProxy
make
2. Create Dockerfile (runtime-only, debian:trixie-slim):
FROM debian:trixie-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY mtproto-proxy /usr/local/bin/mtproto-proxy
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
EXPOSE 443
ENTRYPOINT ["/entrypoint.sh"]
3. Create entrypoint.sh:
#!/bin/sh
set -e
DATA_DIR="${DATA_DIR:-/data}"
mkdir -p "$DATA_DIR"
cd "$DATA_DIR"
# Download Telegram proxy config if not present (persisted in /data volume)
if [ ! -f proxy-secret ] || [ ! -f proxy-multi.conf ]; then
curl -sf https://core.telegram.org/getProxySecret -o proxy-secret
curl -sf https://core.telegram.org/getProxyConfig -o proxy-multi.conf
fi
if [ -z "$SECRET" ]; then
echo "Error: SECRET environment variable is required (32 hex chars)" >&2
exit 1
fi
WORKERS="${WORKERS:-2}"
ARGS="-u nobody -p 8888 -H 443 -S $SECRET --aes-pwd $DATA_DIR/proxy-secret $DATA_DIR/proxy-multi.conf -M $WORKERS"
[ -n "$TAG" ] && ARGS="$ARGS -P $TAG"
exec mtproto-proxy $ARGS
4. Copy binary and build:
cp MTProxy/objs/bin/mtproto-proxy .
docker build -t aleksandrborodavkin/mtproxy:0.02 .
tg://proxy?server=SERVER&port=443&secret=SECRETContent type
Image
Digest
sha256:96e17a383…
Size
34.6 MB
Last updated
7 months ago
docker pull aleksandrborodavkin/mtproxy:0.02