A dockerized version of Tor catered to the user of Haveno.
1.2K
Docker Tor provides an easy way to build and run the Tor daemon from source inside a Docker container. This guide covers using the Docker image, configuration options, running with docker compose and building from source with the included Makefile.
This was originally intended for use for the Haveno project stack however, it can be used by anyone to simplify your experience with Tor.
Tor (The Onion Router) is free and open-source software for enabling anonymous communication. It routes internet traffic through a volunteer overlay network to conceal a user's location and usage from network surveillance or traffic analysis. Tor is commonly used for privacy and protection against online tracking.
To run the Tor Docker image with docker run, use the following command:
docker run -i -d --rm \
-p 9050:9050 \
havenodex/tor
-p 9050:9050: Maps port 9050 on the container (Tor's default SOCKS5 proxy port) to port 9050 on the host.-i -d --rm: Runs the container in the background (-d), keeps it running interactively (-i), and automatically removes it when stopped (--rm).You can also use Docker Compose to run the Tor container. Here’s an example docker-compose.yml file:
version: '3.8'
services:
tor:
image: havenodex/tor
environment:
- TOR_PROXY=true
- TOR_PROXY_PORT=9050
- TOR_CONTROL_PORT=9051
- TOR_SERVICE=false
ports:
- "9050:9050"
- "9051:9051"
image: Specifies the Docker image to use.container_name: Names the container.environment: Configures environment variables (discussed below).ports: Maps ports on the host to the container.Run the container using Docker Compose:
docker-compose up -d
The following environment variables can be used to configure the Tor container:
| Variable | Default Value | Description |
|---|---|---|
TOR_PROXY | true | Enables the Tor SOCKS5 proxy. |
TOR_PROXY_PORT | 9050 | The port for the SOCKS5 proxy. |
TOR_CONTROL | false | Enables the Tor control port. |
TOR_CONTROL_PORT | 9051 | The port for the Tor control interface. |
TOR_SERVICE | false | Enables hidden service hosting. |
TOR_SERVICE_HOSTS | N/A | Comma-separated list of services to expose via Tor. |
TOR_RELAY | false | Enables relay mode to route traffic through the Tor network. |
DATA_DIR | /tor | Directory for Tor data storage. |
PUID | N/A | User ID to run the Tor service. |
PGID | N/A | Group ID to run the Tor service. |
TOR_LOG_CONFIG | false | If true, logs the Tor configuration. |
You can set these variables using the -e flag in docker run or in the environment section of the docker-compose.yml file.
To build the Docker image from source, clone the repository and use the provided Makefile. Ensure Docker is installed and set up for multi-platform builds.
To build the image without GPL features, run:
make build-nogpl
To build the image with GPL features, which include the Proof-of-Work mechanism enabled, run:
make build
To tag the image as latest, use the LATEST flag:
make build LATEST=true
The Makefile includes several commands for building, running, and managing the Docker container:
| Command | Description |
|---|---|
make login | Log in to Docker. |
make list-builders | List available Docker buildx builders. |
make initialise-builder | Initialize a new Docker buildx builder. |
make build-nogpl | Build the Docker image without GPL features. |
make build | Build the Docker image with GPL features. |
make build LATEST=true | Build the Docker image and tag it as latest. |
make build-docs | Build the documentation using MkDocs. |
make run | Run the Docker container. |
make run-arm | Run the Docker container on ARM architecture. |
make stop | Stop the running Docker container. |
make inspect | Inspect the latest Docker image using Buildx. |
make test-install-linux | Install container-structure-test on Linux. |
make test-install-osx | Install container-structure-test on macOS. |
make test | Run container structure tests. |
This Docker image extends the capabilities of Tor by allowing easy source builds with configurable options, making it suitable for various use cases, including running as a proxy, relay, or hidden service.
For more details about Tor and its configuration options, visit the Kewbit.org and you can find the official documentation on The Tor Project website.
Content type
Image
Digest
sha256:1ec6f07bf…
Size
1.1 GB
Last updated
almost 2 years ago
docker pull havenodex/tor