Skip to content

Quickstart

Sam Bent edited this page Nov 17, 2026 · 13 revisions

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) and the Compose plugin.

1. Create a folder and get the compose file

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.yml

Use 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/hiddenforge and Docker Hub (doingfedtime/hiddenforge). Both serve the same digest. The compose file pulls :latest; to check what you pulled before you rely on it, see Verifying the Image.

2. Understand the one line you edit

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:

  • 80 is the port people connect to on your .onion (80 is normal for a website).
  • web is the name of your backend service in this compose file. HiddenForge looks it up on the internal network and finds its address for you.
  • 80 is 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.

3. Start it

docker compose up -d

Tor has to connect to the network, bootstrap to 100%, build a circuit, and publish your service. On a fast connection that took under a minute in the release tests; on a slow one allow up to six minutes, 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 fetch the relay list again too (Tor keeps only its chosen entry guards across restarts), so allow from tens of seconds to a few minutes.

4. Get your address

docker compose exec tor hiddenforge show --name mysite

That prints your .onion. It works the same way on rootless Podman. Open it in Tor Browser and you should see your backend. hiddenforge show --keys ./tor-keys --name mysite also prints it from the host.

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.

5. The one thing you must not lose

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.

Next

  • Swap nginx:alpine for your own app image, keep it on tor-internal only, and run docker compose up -d again. HiddenForge notices the backend's new address by itself.
  • Want more than the defaults? Three options are off until you ask: hiddenforge setup --no-root (nothing runs as root), hiddenforge setup --encrypt-keys (the service key is encrypted on the volume) and hiddenforge client-auth add (only clients with a key can reach the service). See What Changed in 3.0.0.
  • Serving more than one site? See Running Multiple Services.
  • Want to know what just happened under the hood? See How It Works.

Clone this wiki locally