Skip to content
This repository was archived by the owner on Apr 5, 2026. It is now read-only.

Commit f0dc67c

Browse files
committed
Update README.md with Docker usage instructions and environment variables
1 parent ec0c165 commit f0dc67c

1 file changed

Lines changed: 83 additions & 3 deletions

File tree

README.md

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,86 @@ systemctl status MTProxy.service
123123
systemctl enable MTProxy.service
124124
```
125125

126-
## Docker image
127-
Telegram is also providing [official Docker image](https://hub.docker.com/r/telegrammessenger/proxy/).
128-
Note: the image is outdated.
126+
## Docker
127+
128+
### Using Pre-built Docker Image
129+
130+
The easiest way to run MTProxy is using our pre-built Docker image from GitHub Container Registry:
131+
132+
```bash
133+
docker run -d \
134+
--name mtproxy \
135+
-p 443:443 \
136+
-p 8888:8888 \
137+
-e SECRET=$(head -c 16 /dev/urandom | xxd -ps) \
138+
-e PROXY_TAG=your_proxy_tag_here \
139+
-v mtproxy-data:/opt/mtproxy/data \
140+
--restart unless-stopped \
141+
ghcr.io/getpagespeed/mtproxy:latest
142+
```
143+
144+
#### Environment Variables
145+
146+
- `SECRET`: User secret for proxy connections (auto-generated if not provided)
147+
- `PORT`: Port for client connections (default: 443)
148+
- `STATS_PORT`: Port for statistics endpoint (default: 8888)
149+
- `WORKERS`: Number of worker processes (default: 1)
150+
- `PROXY_TAG`: Proxy tag from [@MTProxybot](https://t.me/MTProxybot)
151+
- `RANDOM_PADDING`: Enable random padding mode (true/false, default: false)
152+
153+
#### Getting Statistics
154+
155+
```bash
156+
curl http://localhost:8888/stats
157+
```
158+
159+
### Using Docker Compose
160+
161+
Create a `.env` file:
162+
```bash
163+
SECRET=your_secret_here
164+
PROXY_TAG=your_proxy_tag_here
165+
RANDOM_PADDING=false
166+
```
167+
168+
Then run:
169+
```bash
170+
docker-compose up -d
171+
```
172+
173+
### Building Your Own Image
174+
175+
If you want to build the image yourself:
176+
177+
```bash
178+
docker build -t mtproxy .
179+
docker run -d \
180+
--name mtproxy \
181+
-p 443:443 \
182+
-p 8888:8888 \
183+
-e SECRET=your_secret_here \
184+
mtproxy
185+
```
186+
187+
### Health Check
188+
189+
The Docker container includes a health check that monitors the statistics endpoint. You can check the container health with:
190+
191+
```bash
192+
docker ps
193+
# Look for the health status in the STATUS column
194+
```
195+
196+
### Volume Mounting
197+
198+
The container persists configuration files in `/opt/mtproxy/data`. Mount a volume to persist data across container restarts:
199+
200+
```bash
201+
-v /path/to/host/data:/opt/mtproxy/data
202+
```
203+
204+
### Available Tags
205+
206+
- `ghcr.io/getpagespeed/mtproxy:latest` - Latest stable build from master branch
207+
- `ghcr.io/getpagespeed/mtproxy:master` - Latest build from master branch
208+
- `ghcr.io/getpagespeed/mtproxy:v*` - Specific version tags (when available)

0 commit comments

Comments
 (0)