How to run SearXNG with Docker


This post goes over how to install and run SearXNG with Docker.

Install

Install Docker:

brew install --cask docker

Download the image:

docker pull searxng/searxng

Run

Start a new container:

docker run -d --name searxng -p 8080:8080 searxng/searxng

Open in your browser:

open http://localhost:8080

When requesting JSON, you will receive 403 Forbidden error:

curl 'http://localhost:8080/search?q=test&format=json'

This is because you need to enable it in settings:

SECRET_KEY=$(openssl rand -hex 32)

cat > settings.yml <<EOF
use_default_settings: true

server:
  secret_key: "$SECRET_KEY"
  bind_address: "0.0.0.0"
  port: 8080

search:
  formats:
    - html
    - json
EOF

Copy settings.yml into the container:

docker cp settings.yml searxng:/etc/searxng/settings.yml

Then restart the container:

docker restart searxng

Check the logs that it worked:

docker logs searxng --tail=100

Stop

Stop and remove the container:

docker rm -f searxng


Please support this site and join our Discord!