Self-Hosting SearXNG on a Raspberry Pi with Docker
Search engines are the biggest data brokers on the internet. The fix is easy: run your own metasearch instance and stop handing every query to one company.
Here's how I run SearXNG on a Raspberry Pi 4 (8GB) with Docker — private search, 270+ engines, and zero monthly cost.
Why SearXNG
SearXNG is a metasearch engine — it queries many upstream engines (Google, Bing, DuckDuckGo, and hundreds more) and merges the results. Your query goes to the engines through the SearXNG instance, so your IP and browser fingerprint stay private. It also returns clean JSON for programmatic use, which makes it a great backend for agent tooling.
The setup
Three files and you're done:
# docker-compose.yml
services:
searxng:
image: searxng/searxng:latest
ports:
- "127.0.0.1:8888:8080"
volumes:
- ./searxng:/etc/searxng
environment:
- SEARXNG_BASE_URL=http://localhost:8888/
- SEARXNG_SECRET=your-secret-here
- TZ=Asia/Jakarta
Generate the secret, start it, and the container writes a default settings file on first boot.
openssl rand -hex 32 > .searxng_secret
docker compose up -d
Enabling the JSON API
For agent/script usage you need the JSON format. Add this to settings.yml and restart:
search:
formats:
- html
- json
Results
On first boot, SearXNG reports 274 engines registered. With the JSON API enabled, a search is one GET request:
curl "http://localhost:8888/search?q=raspberry+pi&format=json"
It's fast (sub-second on a Pi 4), totally free, and the whole thing uses about 300MB of RAM — a rounding error on an 8GB Pi.
Notes from the trenches
- Bind to
127.0.0.1unless you want the whole network using your instance. - The container writes config as root —
sudo chownthe volume once so you can edit it. - Some engines (wikidata, google) will 403 from datacenter/shared IPs. That's normal — SearXNG falls back to the engines that respond.
Private search, self-hosted, on hardware you own. That's the Pi way.