The super easy way to set up a Tor SOCKS5 proxy server inside a Docker container, without Tor relay/exit node function enabled.
We push the built image to Docker Hub and GitHub Container Registry:
- GitHub Container Registry:
ghcr.io/peterdavehello/tor-socks-proxy
- https://github.com/PeterDaveHello/tor-socks-proxy/pkgs/container/tor-socks-proxy
- Docker Hub:
peterdavehello/tor-socks-proxy
- https://hub.docker.com/r/peterdavehello/tor-socks-proxy/
Use the prefix ghcr.io/
if you prefer to use GitHub Container Registry.
docker run -d --restart=always --name tor-socks-proxy -p 127.0.0.1:9150:9150/tcp peterdavehello/tor-socks-proxy:latest
--restart=always
: This ensures the container automatically restarts whenever the system reboots.-p 127.0.0.1:9150:9150/tcp
: This binds the container to localhost, and you should not change this IP unless you want to expose the proxy to a local network or the Internet.- You can change the first
9150
to any available port. Please note that ports9050
/9150
may be occupied if you are running another Tor client like TorBrowser.
- You can change the first
docker start tor-socks-proxy
docker stop tor-socks-proxy
docker logs tor-socks-proxy
curl --socks5-hostname 127.0.0.1:9150 https://ipinfo.tw/ip
docker stop tor-socks-proxy
By default, Tor automatically changes IPs every 10 minutes. You can manually renew the IP by restarting the container:
docker restart tor-socks-proxy
Publish DNS port during setup to query DNS requests over Tor:
docker run -d --restart=always --name tor-socks-proxy -p 127.0.0.1:9150:9150/tcp -p 127.0.0.1:53:8853/udp peterdavehello/tor-socks-proxy:latest
This project is now sponsored by DigitalOcean, providing us with a dedicated development and testing environment.
For cloud VPS hosting with $200 in free credit, consider using my DigitalOcean referral link: https://m.do.co/c/1fdd0a1d695a
Support the Tor project by setting up Tor bridge/exit nodes and donating.