Repository navigation
Quickstart
This gets you a working .onion address pointing at a web app. The example uses Docker Compose and a plain nginx backend; swap in your own app once it works.
You need Docker (or Podman) with the Compose plugin. Nothing else.
Make a folder to hold your setup and a place for the keys, then download the compose file the project ships and tests:
mkdir -p hiddenforge/tor-keys
cd hiddenforge
curl -O https://sambent.dev/sam/HiddenForge/raw/branch/master/docker-compose.ymlUse that file rather than writing your own: its hardening settings (dropped
capabilities, read-only filesystem, no swap, process limit, logging off) are checked by hiddenforge doctor against the running container,
and a hand-copied version drifts. On rootless Podman, use podman-compose.yml from
the same place instead, and follow Rootless Podman: it needs
two settings to survive a reboot and reads the address differently.
It defines two services: tor (HiddenForge) and web, a placeholder nginx
backend that sits only on the internal network, reachable by Tor and not from
the internet.
The image is published to both
sambent.dev/sam/hiddenforgeand Docker Hub (doingfedtime/hiddenforge). Both serve the identical digest; use whichever you prefer.
The only required setting is the service-hosts variable, on the line marked
<-- EDIT:
MYAPP_TOR_SERVICE_HOSTS: "80:web:80"Read it left to right as onion_port : backend_name : backend_port:
-
80is the port people connect to on your.onion(80 is normal for a website). -
webis the name of your backend service in this compose file. HiddenForge looks it up on the internal network and finds its address for you. -
80is the port your backend listens on.
The prefix (MYAPP) becomes your service's folder name, lowercased with underscores turned into hyphens. So MYAPP becomes a service called myapp. Rename it to anything (letters, digits, _ and -), for example MYSITE; the rest of this page uses mysite.
docker compose up -dThe first start takes a few minutes. Tor has to connect to the network, bootstrap to 100%, build a circuit, and publish your service. Two to six minutes is normal on a first run, depending on how fast Tor fetches the network's relay list. The container reports itself "healthy" only once it is reachable, not just running. Later restarts start Tor from scratch too (its state is not kept), so allow from tens of seconds to a few minutes.
docker compose exec tor cat /var/lib/tor/hidden_service/mysite/hostnameOn rootless Podman, read it as the tor user instead (see Rootless Podman for why):
... exec tor su-exec tor cat /var/lib/tor/hidden_service/mysite/hostname.
That prints your .onion. Open it in Tor Browser and you should see your backend.
If it isn't up yet, give it another minute and try again. If it still isn't working after a few minutes, see Troubleshooting.
Your address lives in the ./tor-keys folder you created. Back it up. If you lose the key file inside it, the address is gone for good and there is no way to recover it. Read Backing Up Your Onion Address before you put anything real on it.
- Swap
nginx:alpinefor your own app image, keep it ontor-internalonly, and rundocker compose up -dagain. HiddenForge notices the backend's new address by itself. - Serving more than one site? See Running Multiple Services.
- Want to know what just happened under the hood? See How It Works.
Start here
Older releases
Going deeper
- The Security Model
- Verifying the Image
- Reproducing the Build
- The hiddenforge CLI
- Rootless Podman
- Backing Up Your Onion Address
- Upgrading Safely
- Running Multiple Services
Help