A lightweight Docker image providing a Tor proxy + obfs4 bridges
1.2K
A lightweight, secure, and configurable Tor proxy running on Alpine Linux. This image includes obfs4proxy compiled from source (from Yawning/obfs4) to ensure support for the latest obfuscation protocols.
https://github.com/aaokunev/tor-proxy
obfs4proxy built from source (multi-stage build).stdout for native Docker logging.chown needed on host).curl, vim, and ping for debugging.torrc file (see the Configuration section below).docker-compose.yml:version: '3.8'
services:
tor:
image: okunev/tor-proxy:latest
container_name: tor-proxy
restart: unless-stopped
ports:
- "9050:9050" # SOCKS5 Proxy
- "9053:9053/udp" # DNS (UDP)
- "9053:9053/tcp" # DNS (TCP)
volumes:
- ./torrc:/etc/tor/torrc:ro
- tor_data:/var/lib/tor
volumes:
tor_data:
docker-compose up -d
docker run -d \
--name tor-proxy \
--restart unless-stopped \
-p 9050:9050 \
-p 9053:9053/tcp \
-p 9053:9053/udp \
-v "$(pwd)/torrc:/etc/tor/torrc:ro" \
-v tor_data:/var/lib/tor \
okunev/tor-proxy:latest
torrc)This image requires a torrc file mounted at /etc/tor/torrc.
Minimal working example for Docker:
## 1. Logging (Crucial for Docker)
# Send logs to stdout so 'docker logs' works
Log notice stdout
## 2. Network
# Bind to 0.0.0.0 to allow access from outside the container
SocksPort 0.0.0.0:9050
DNSPort 0.0.0.0:9053
## 3. Data Storage
# This path is persistent via the volume defined in docker-compose
DataDirectory /var/lib/tor
## 4. Bridges (Optional but recommended)
UseBridges 1
# Point to the obfs4proxy binary inside the container
ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
# Add your bridges here (Get them from bridges.torproject.org)
# Bridge obfs4 <IP>:<PORT> <FINGERPRINT> cert=<CERT> iat-mode=0
| Path | Description |
|---|---|
/etc/tor/torrc | Mount your configuration file here (Read-Only recommended). |
/var/lib/tor | Persistence. Mount a volume here. Stores keys, cache, and guard nodes. |
Note on Permissions:
The image includes an entrypoint script. When the container starts, it automatically adjusts the ownership of /var/lib/tor to the internal tor user. You do not need to manually chown your Docker volumes on the host machine.
Once running, verify that the proxy is working:
1. Check connection via SOCKS5:
curl --socks5-hostname localhost:9050 -s https://check.torproject.org/ | grep -i "congratulations"
2. Check DNS resolution:
dig @localhost -p 9053 google.com
3. View Logs:
docker logs -f tor-proxy
This image is provided "as is". Users are responsible for complying with their local laws and regulations regarding the use of Tor and encryption software.
After the container starts, the proxy is not available immediately. Tor needs some time to bootstrap and establish the connection. You can watch the bootstrap process in real time with:
docker logs -f tor-proxy
Content type
Image
Digest
sha256:c50eb1fdd…
Size
23.8 MB
Last updated
3 months ago
docker pull okunev/tor-proxy