run a tor relay in a container 中文
middle:
docker run -d \
--restart always \
-v /etc/localtime:/etc/localtime:ro \
-p 9001:9001 \
--name tor-relay \
chenjia404/tor-relay -f /etc/tor/torrc.middleBridge relay:
docker run -d \
--restart always \
-v /etc/localtime:/etc/localtime:ro \
-p 9001:9001 \
--name tor-relay \
chenjia404/tor-relay -f /etc/tor/torrc.bridgeExit relay:
docker run -d \
--restart always \
-v /etc/localtime:/etc/localtime:ro \
-p 9001:9001 \
--name tor-relay \
chenjia404/tor-relay -f /etc/tor/torrc.exitSave the key and data of the relay node:
mkdir -p /home/tor-data
chown -R 100:100 /home/tor-data
docker run -d \
--restart always \
-v /home/tor-data:/var/lib/tor/.tor
-v /etc/localtime:/etc/localtime:ro \
-p 9001:9001 \
--name tor-relay \
chenjia404/tor-relay -f /etc/tor/torrc.middletor-0.4.9.6
This repository includes a GitHub Actions workflow that rebuilds and pushes the Docker image every month.
Add these repository secrets in Settings > Secrets and variables > Actions:
| Name | Description |
|---|---|
DOCKERHUB_USERNAME |
Docker Hub username |
DOCKERHUB_TOKEN |
Docker Hub access token |
Workflow file:
.github/workflows/monthly-image-rebuild.yml
Triggers:
- On every push to
master - Automatically on the 1st day of every month at
03:00 UTC - Manually via
workflow_dispatch
Published tags:
latestYYYYMM, for example202604
Published platforms:
linux/amd64linux/arm64
| Name | Description | Default value |
|---|---|---|
| RELAY_TYPE | The type of relay (bridge, middle or exit) | middle |
| RELAY_NICKNAME | The nickname of your relay | default |
| CONTACT_GPG_FINGERPRINT | Your GPG ID or fingerprint | none |
| CONTACT_NAME | Your name | none |
| CONTACT_EMAIL | Your contact email | none |
| RELAY_BANDWIDTH_RATE | Limit how much traffic will be allowed through your relay (must be > 20KB/s) | 10000 KBytes |
| RELAY_BANDWIDTH_BURST | Allow temporary bursts up to a certain amount | 20000 KBytes |
| RELAY_PORT | Default port used for incoming Tor connections (ORPort) | 9001 |