You can configure your tor container with environment variables. Just write a TOR_ prefix at your environment variables and they will be translated into a torrc file at /etc/tor/torrc inside the container. For multiple settings with the same directive, prefix a number like TOR_0_ORPort, TOR_1_ORPort and so on (the entrypoint sorts the variables to keep ordering stable).
This container can work as a relay or a proxy, whatever you want to configure. Minimum requirements are to know how torrc works (it's very easy—looking at the examples below you will know how to use it).
Container works as proxy and relay by default. Override the configuration with environment variables to disable or change ports.
A little example, using tor as relay and proxy at the same time. Build locally if you are working on this repo; otherwise pull the published image.
services:
tor:
image: archhfan/tor-docker:latest
# build: . # uncomment when building locally
environment:
TOR_Nickname: MyRelayNick
TOR_ContactInfo: mail@example.com
# TOR_SocksPort: 0.0.0.0:9050
# TOR_ORPort: 9001
volumes:
- tor-data:/var/lib/tor
ports:
- "9001:9001" # Relay ORPort
- "9030:9030" # Relay DirPort
- "127.0.0.1:9050:9050" # Local SOCKS proxy
volumes:
tor-data:Default values of the environment variables with their respective directive.
| ENV Variable | torrc Directive | Value | Effect |
|---|---|---|---|
TOR_SocksPort |
SocksPort |
0.0.0.0:9050 |
Opens a SOCKS listener on all interfaces for client use. |
TOR_RunAsDaemon |
RunAsDaemon |
0 |
Keeps Tor in the foreground (necessary in Docker containers). |
TOR_0_ORPort |
ORPort |
9001 |
Enables IPv4 relay-to-relay (“onion routing”) on TCP port 9001. |
TOR_1_ORPort |
ORPort |
[::]:9001 |
Enables IPv6 relay-to-relay on TCP port 9001. |
TOR_DirPort |
DirPort |
9030 |
Serves directory information on TCP port 9030. |
TOR_DataDirectory |
DataDirectory |
/var/lib/tor |
Places Tor’s state, keys, and caches under /var/lib/tor. |
- At startup the entrypoint rewrites
/etc/tor/torrcusing every environment variable prefixed withTOR_. - Variables are sorted before writing; if you need a specific order for repeated directives, number them (
TOR_0_ORPort,TOR_1_ORPort). For more than nine entries, zero‑pad numbers (TOR_00_...). - Empty values are skipped to avoid generating invalid
torrclines. - The data directory is created if missing and ownership is fixed, then the process drops privileges with
su-execto run Tor as thetoruser. - Non-root/runtime compatibility (K8s
runAsNonRoot, rootless Docker/Podman): when PID 1 is not root, the entrypoint skipschown/su-execand runs as-is. Ensure/etc/tor/torrcand yourDataDirectoryare writable (e.g., mount a writable volume, setfsGroup, or pre-chown with an initContainer).
Este repositorio viene gracias a que Javier Tebas, director de LaLiga, se dedica a cortar la conexión de CDNs famosas como Cloudflare, o de proveedores de servicio como Vercel o Netlify. Estos bloquean las CDNs los días que hay partidos de LaLiga, afectando a miles de usuarios de ciertas ISPs sobre las que tienen poder, haciendo que muchas páginas webs y servicios se queden inhabilitados para los usuarios finales.
No puede ser que en 2025, una empresa privada esté controlando el tráfico de un país solamente por un móvil económico, sin ningún tipo de motivo de peso. Por eso, decidí crear este repositorio y que cualquier persona tenga accesible la red tor de manera sencilla.
This repository exists because Javier Tebas, the president of LaLiga, has taken to cutting off connections to major CDNs like Cloudflare, as well as service providers such as Vercel and Netlify. These CDNs are blocked on match days, impacting thousands of users on certain ISPs under his influence, leaving many websites and services inaccessible to end users.
It’s unacceptable that in 2025, a private company can control the traffic of an entire country over something as trivial as a budget smartphone, without any valid justification. That’s why I created this repository—to give anyone easy access to the Tor network.
