Easily setup a Onion Service using Docker

Some time ago I’ve written a post about Tor Onion Services (formerly known as hidden services), and how to host them on a spare android smartphone.

Tor makes possible for users to hide their locations while offering various kinds of services, such as web publishing or an instant messaging server. Using Tor “rendezvous points,” other Tor users can connect to these onion services each without knowing the other’s network identity.

Initially, the setup of a Onion Service on tor network was a process not really hard, but not really simple for beginners.

Now, with the spread of Docker, a lot of complex steps can be accomplished with few commands.
GitHub user opsxcq released a docker image that simplify all steps of the process, from custom .onion name generator to webserver configuration and hidden service pubblication:


Let’s create a onion service with the name beginning with strm.

docker pull strm/tor-hiddenservice-nginx

Wait to the container image be downloaded. And them we can generate our site skeleton:

$docker run -it --rm -v $(pwd)/web:/web strm/tor-hiddenservice-nginx generate ^strm
[+] Generating the address with mask: ^strm
[+] Found matching domain after 137072 tries: strmfyygjp5st54g.onion
[+] Generating nginx configuration for site  strmfyygjp5st54g.onion
[+] Creating www folder
[+] Generating index.html template

Now we have our skeleton generated, we can run the container with:

docker run -d --restart=always --name hiddensite \
       -v $(pwd)/web:/web strm/tor-hiddenservice-nginx

And you have the service running ! 🙂

References and further readings


This site uses Akismet to reduce spam. Learn how your comment data is processed.