installation-docker.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <!DOCTYPE html>
  2. <html lang="en" data-content_root="../">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>Installation container &#8212; SearXNG Documentation (2025.7.4+01be2612a)</title>
  8. <link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=6625fa76" />
  9. <link rel="stylesheet" type="text/css" href="../_static/searxng.css?v=52e4ff28" />
  10. <script src="../_static/documentation_options.js?v=657a83fe"></script>
  11. <script src="../_static/doctools.js?v=9a2dae69"></script>
  12. <script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
  13. <script data-project="searxng" data-version="2025.7.4+01be2612a" src="../_static/describe_version.js?v=fa7f30d0"></script>
  14. <link rel="index" title="Index" href="../genindex.html" />
  15. <link rel="search" title="Search" href="../search.html" />
  16. <link rel="next" title="Installation Script" href="installation-scripts.html" />
  17. <link rel="prev" title="Installation" href="installation.html" />
  18. </head><body>
  19. <div class="related" role="navigation" aria-label="Related">
  20. <h3>Navigation</h3>
  21. <ul>
  22. <li class="right" style="margin-right: 10px">
  23. <a href="../genindex.html" title="General Index"
  24. accesskey="I">index</a></li>
  25. <li class="right" >
  26. <a href="../py-modindex.html" title="Python Module Index"
  27. >modules</a> |</li>
  28. <li class="right" >
  29. <a href="installation-scripts.html" title="Installation Script"
  30. accesskey="N">next</a> |</li>
  31. <li class="right" >
  32. <a href="installation.html" title="Installation"
  33. accesskey="P">previous</a> |</li>
  34. <li class="nav-item nav-item-0"><a href="../index.html">SearXNG Documentation (2025.7.4+01be2612a)</a> &#187;</li>
  35. <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Administrator documentation</a> &#187;</li>
  36. <li class="nav-item nav-item-this"><a href="">Installation container</a></li>
  37. </ul>
  38. </div>
  39. <div class="document">
  40. <div class="documentwrapper">
  41. <div class="bodywrapper">
  42. <div class="body" role="main">
  43. <section id="installation-container">
  44. <span id="id1"></span><h1>Installation container<a class="headerlink" href="#installation-container" title="Link to this heading">¶</a></h1>
  45. <aside class="sidebar">
  46. <p class="sidebar-title">info</p>
  47. <ul class="simple">
  48. <li><p><a class="reference external" href="https://docs.docker.com/get-started/docker-overview">Docker 101</a></p></li>
  49. <li><p><a class="reference external" href="https://docs.docker.com/get-started/docker_cheatsheet.pdf">Docker cheat sheet (PDF doc)</a></p></li>
  50. <li><p><a class="reference external" href="https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md">Podman rootless containers</a></p></li>
  51. </ul>
  52. </aside>
  53. <div class="admonition important">
  54. <p class="admonition-title">Important</p>
  55. <p>Understanding container architecture basics is essential for properly
  56. maintaining your SearXNG instance. This guide assumes familiarity with
  57. container concepts and provides deployment steps at a high level.</p>
  58. <p>If you’re new to containers, we recommend learning the fundamentals at
  59. <a class="reference external" href="https://docs.docker.com/get-started/docker-overview">Docker 101</a> before proceeding.</p>
  60. </div>
  61. <p>Container images are the basis for deployments in containerized environments,
  62. <a class="reference external" href="https://github.com/searxng/searxng-docker">Docker compose</a>, Kubernetes and more.</p>
  63. <section id="installation">
  64. <span id="container-installation"></span><h2>Installation<a class="headerlink" href="#installation" title="Link to this heading">¶</a></h2>
  65. <section id="prerequisites">
  66. <span id="container-prerequisites"></span><h3>Prerequisites<a class="headerlink" href="#prerequisites" title="Link to this heading">¶</a></h3>
  67. <p>You need a working Docker or Podman installation on your system. Choose the
  68. option that works best for your environment:</p>
  69. <ul class="simple">
  70. <li><p><a class="reference external" href="https://docs.docker.com/get-docker/">Docker</a> (recommended for most users)</p></li>
  71. <li><p><a class="reference external" href="https://podman.io/docs/installation">Podman</a></p></li>
  72. </ul>
  73. <p>In the case of Docker, you need to add the user running the container to the
  74. <code class="docutils literal notranslate"><span class="pre">docker</span></code> group and restart the session:</p>
  75. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>sudo<span class="w"> </span>usermod<span class="w"> </span>-aG<span class="w"> </span>docker<span class="w"> </span><span class="nv">$USER</span>
  76. </pre></div>
  77. </div>
  78. <p>In the case of Podman, no additional steps are generally required, but there
  79. are some considerations when running <a class="reference external" href="https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md">Podman rootless containers</a>.</p>
  80. </section>
  81. <section id="pulling-images">
  82. <span id="container-pulling-images"></span><h3>Pulling images<a class="headerlink" href="#pulling-images" title="Link to this heading">¶</a></h3>
  83. <div class="admonition note">
  84. <p class="admonition-title">Note</p>
  85. <p>DockerHub now applies rate limits to unauthenticated image pulls. If you
  86. are affected by this, you can use the <a class="reference external" href="https://ghcr.io/searxng/searxng">GHCR mirror</a> instead.</p>
  87. </div>
  88. <p>The official images are mirrored at:</p>
  89. <ul class="simple">
  90. <li><p><a class="reference external" href="https://hub.docker.com/r/searxng/searxng">DockerHub mirror</a></p></li>
  91. <li><p><a class="reference external" href="https://ghcr.io/searxng/searxng">GHCR mirror</a> (GitHub Container Registry)</p></li>
  92. </ul>
  93. <p>Pull the latest image:</p>
  94. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>docker<span class="w"> </span>pull<span class="w"> </span>docker.io/searxng/searxng:latest
  95. </pre></div>
  96. </div>
  97. <p>.. or if you want to lock in to a specific version:</p>
  98. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>docker<span class="w"> </span>pull<span class="w"> </span>docker.io/searxng/searxng:2025.6.3-b73ac81
  99. </pre></div>
  100. </div>
  101. </section>
  102. </section>
  103. <section id="instancing">
  104. <span id="container-instancing"></span><h2>Instancing<a class="headerlink" href="#instancing" title="Link to this heading">¶</a></h2>
  105. <p>This section is intended for advanced users who need custom deployments. We
  106. recommend using <a class="reference external" href="https://github.com/searxng/searxng-docker">Docker compose</a>, which provides a preconfigured environment
  107. with sensible defaults.</p>
  108. <p>Basic container instancing example:</p>
  109. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span><span class="c1"># Create directories for configuration and persistent data</span>
  110. $<span class="w"> </span>mkdir<span class="w"> </span>-p<span class="w"> </span>./searxng/config/<span class="w"> </span>./searxng/data/
  111. $<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>./searxng/
  112. <span class="c1"># Run the container</span>
  113. $<span class="w"> </span>docker<span class="w"> </span>run<span class="w"> </span>--name<span class="w"> </span>searxng<span class="w"> </span>--replace<span class="w"> </span>-d<span class="w"> </span><span class="se">\</span>
  114. <span class="w"> </span>-p<span class="w"> </span><span class="m">8888</span>:8080<span class="w"> </span><span class="se">\</span>
  115. <span class="w"> </span>-v<span class="w"> </span><span class="s2">&quot;./config/:/etc/searxng/&quot;</span><span class="w"> </span><span class="se">\</span>
  116. <span class="w"> </span>-v<span class="w"> </span><span class="s2">&quot;./data/:/var/cache/searxng/&quot;</span><span class="w"> </span><span class="se">\</span>
  117. <span class="w"> </span>docker.io/searxng/searxng:latest
  118. </pre></div>
  119. </div>
  120. <p>This will start SearXNG in the background, accessible at <a class="reference external" href="http://localhost:8888">http://localhost:8888</a></p>
  121. <section id="management">
  122. <span id="container-management"></span><h3>Management<a class="headerlink" href="#management" title="Link to this heading">¶</a></h3>
  123. <p>List running containers:</p>
  124. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>docker<span class="w"> </span>container<span class="w"> </span>list
  125. CONTAINER<span class="w"> </span>ID<span class="w"> </span>IMAGE<span class="w"> </span>...<span class="w"> </span>CREATED<span class="w"> </span>PORTS<span class="w"> </span>NAMES
  126. 37f6487c8703<span class="w"> </span>...<span class="w"> </span>...<span class="w"> </span><span class="m">3</span><span class="w"> </span>minutes<span class="w"> </span>ago<span class="w"> </span><span class="m">0</span>.0.0.0:8888-&gt;8080/tcp<span class="w"> </span>searxng
  127. </pre></div>
  128. </div>
  129. <p>Access the container shell (troubleshooting):</p>
  130. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>docker<span class="w"> </span>container<span class="w"> </span><span class="nb">exec</span><span class="w"> </span>-it<span class="w"> </span>--user<span class="w"> </span>root<span class="w"> </span>searxng<span class="w"> </span>/bin/sh<span class="w"> </span>-l
  131. 37f6487c8703:/usr/local/searxng#
  132. </pre></div>
  133. </div>
  134. <p>Stop and remove the container:</p>
  135. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>docker<span class="w"> </span>container<span class="w"> </span>stop<span class="w"> </span>searxng
  136. $<span class="w"> </span>docker<span class="w"> </span>container<span class="w"> </span>rm<span class="w"> </span>searxng
  137. </pre></div>
  138. </div>
  139. </section>
  140. </section>
  141. <section id="volumes">
  142. <span id="container-volumes"></span><h2>Volumes<a class="headerlink" href="#volumes" title="Link to this heading">¶</a></h2>
  143. <p>Two volumes are exposed that should be mounted to preserve its contents:</p>
  144. <ul class="simple">
  145. <li><p><code class="docutils literal notranslate"><span class="pre">/etc/searxng</span></code>: Configuration files (settings.yml, etc.)</p></li>
  146. <li><p><code class="docutils literal notranslate"><span class="pre">/var/cache/searxng</span></code>: Persistent data (faviconcache.db, etc.)</p></li>
  147. </ul>
  148. </section>
  149. <section id="environment-variables">
  150. <span id="container-environment-variables"></span><h2>Environment variables<a class="headerlink" href="#environment-variables" title="Link to this heading">¶</a></h2>
  151. <p>The following environment variables can be configured:</p>
  152. <ul class="simple">
  153. <li><p><code class="docutils literal notranslate"><span class="pre">$SEARXNG_*</span></code>: Controls the SearXNG configuration options, look out for
  154. environment <code class="docutils literal notranslate"><span class="pre">$SEARXNG_*</span></code> in <a class="reference internal" href="settings/settings_server.html#settings-server"><span class="std std-ref">server:</span></a> and <a class="reference internal" href="settings/settings_general.html#settings-general"><span class="std std-ref">general:</span></a>.</p></li>
  155. <li><p><code class="docutils literal notranslate"><span class="pre">$GRANIAN_*</span></code>: Controls the <a class="reference internal" href="installation-granian.html#granian-configuration"><span class="std std-ref">Granian server options</span></a>.</p></li>
  156. <li><p><code class="docutils literal notranslate"><span class="pre">$FORCE_OWNERSHIP</span></code>: Ensures mounted volumes/files are owned by the
  157. <code class="docutils literal notranslate"><span class="pre">searxng:searxng</span></code> user (default: <code class="docutils literal notranslate"><span class="pre">true</span></code>)</p></li>
  158. </ul>
  159. <p>Container internal paths (don’t modify unless you know what you’re doing):</p>
  160. <ul class="simple">
  161. <li><p><code class="docutils literal notranslate"><span class="pre">$CONFIG_PATH</span></code>: Path to the SearXNG configuration directory (default: <code class="docutils literal notranslate"><span class="pre">/etc/searxng</span></code>)</p></li>
  162. <li><p><code class="docutils literal notranslate"><span class="pre">$SEARXNG_SETTINGS_PATH</span></code>: Path to the SearXNG settings file (default: <code class="docutils literal notranslate"><span class="pre">$CONFIG_PATH/settings.yml</span></code>)</p></li>
  163. <li><p><code class="docutils literal notranslate"><span class="pre">$DATA_PATH</span></code>: Path to the SearXNG data directory (default: <code class="docutils literal notranslate"><span class="pre">/var/cache/searxng</span></code>)</p></li>
  164. </ul>
  165. </section>
  166. <section id="custom-images">
  167. <span id="container-custom-images"></span><h2>Custom images<a class="headerlink" href="#custom-images" title="Link to this heading">¶</a></h2>
  168. <p>To build your own SearXNG container image from source (please note, custom
  169. container images are not officially supported):</p>
  170. <div class="highlight-sh notranslate"><div class="highlight"><pre><span></span>$<span class="w"> </span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/searxng/searxng.git
  171. $<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>./searxng/
  172. <span class="c1"># Run the container build script</span>
  173. $<span class="w"> </span>make<span class="w"> </span>container
  174. $<span class="w"> </span>docker<span class="w"> </span>images
  175. REPOSITORY<span class="w"> </span>TAG<span class="w"> </span>IMAGE<span class="w"> </span>ID<span class="w"> </span>CREATED<span class="w"> </span>SIZE
  176. localhost/searxng/searxng<span class="w"> </span>latest<span class="w"> </span>b14e256bfc36<span class="w"> </span><span class="m">14</span><span class="w"> </span>seconds<span class="w"> </span>ago<span class="w"> </span><span class="m">201</span><span class="w"> </span>MB
  177. localhost/searxng/searxng<span class="w"> </span><span class="m">2025</span>.5.1-b653119ab-dirty<span class="w"> </span>b14e256bfc36<span class="w"> </span><span class="m">14</span><span class="w"> </span>seconds<span class="w"> </span>ago<span class="w"> </span><span class="m">201</span><span class="w"> </span>MB
  178. localhost/searxng/searxng<span class="w"> </span>builder<span class="w"> </span>7f334c752b41<span class="w"> </span><span class="m">20</span><span class="w"> </span>seconds<span class="w"> </span>ago<span class="w"> </span><span class="m">765</span><span class="w"> </span>MB
  179. ghcr.io/searxng/base<span class="w"> </span>searxng-builder<span class="w"> </span>7d6b8a1bed4a<span class="w"> </span><span class="m">20</span><span class="w"> </span>hours<span class="w"> </span>ago<span class="w"> </span><span class="m">625</span><span class="w"> </span>MB
  180. ghcr.io/searxng/base<span class="w"> </span>searxng<span class="w"> </span>29baf9ef13ef<span class="w"> </span><span class="m">20</span><span class="w"> </span>hours<span class="w"> </span>ago<span class="w"> </span><span class="m">62</span>.5<span class="w"> </span>MB
  181. </pre></div>
  182. </div>
  183. </section>
  184. </section>
  185. <div class="clearer"></div>
  186. </div>
  187. </div>
  188. </div>
  189. <span id="sidebar-top"></span>
  190. <div class="sphinxsidebar" role="navigation" aria-label="Main">
  191. <div class="sphinxsidebarwrapper">
  192. <p class="logo"><a href="../index.html">
  193. <img class="logo" src="../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/>
  194. </a></p>
  195. <h3><a href="../index.html">Table of Contents</a></h3>
  196. <ul class="current">
  197. <li class="toctree-l1"><a class="reference internal" href="../user/index.html">User information</a></li>
  198. <li class="toctree-l1"><a class="reference internal" href="../own-instance.html">Why use a private instance?</a></li>
  199. <li class="toctree-l1 current"><a class="reference internal" href="index.html">Administrator documentation</a><ul class="current">
  200. <li class="toctree-l2"><a class="reference internal" href="settings/index.html">Settings</a></li>
  201. <li class="toctree-l2"><a class="reference internal" href="installation.html">Installation</a></li>
  202. <li class="toctree-l2 current"><a class="current reference internal" href="#">Installation container</a><ul>
  203. <li class="toctree-l3"><a class="reference internal" href="#installation">Installation</a><ul>
  204. <li class="toctree-l4"><a class="reference internal" href="#prerequisites">Prerequisites</a></li>
  205. <li class="toctree-l4"><a class="reference internal" href="#pulling-images">Pulling images</a></li>
  206. </ul>
  207. </li>
  208. <li class="toctree-l3"><a class="reference internal" href="#instancing">Instancing</a><ul>
  209. <li class="toctree-l4"><a class="reference internal" href="#management">Management</a></li>
  210. </ul>
  211. </li>
  212. <li class="toctree-l3"><a class="reference internal" href="#volumes">Volumes</a></li>
  213. <li class="toctree-l3"><a class="reference internal" href="#environment-variables">Environment variables</a></li>
  214. <li class="toctree-l3"><a class="reference internal" href="#custom-images">Custom images</a></li>
  215. </ul>
  216. </li>
  217. <li class="toctree-l2"><a class="reference internal" href="installation-scripts.html">Installation Script</a></li>
  218. <li class="toctree-l2"><a class="reference internal" href="installation-searxng.html">Step by step installation</a></li>
  219. <li class="toctree-l2"><a class="reference internal" href="installation-granian.html">Granian</a></li>
  220. <li class="toctree-l2"><a class="reference internal" href="installation-uwsgi.html">uWSGI</a></li>
  221. <li class="toctree-l2"><a class="reference internal" href="installation-nginx.html">NGINX</a></li>
  222. <li class="toctree-l2"><a class="reference internal" href="installation-apache.html">Apache</a></li>
  223. <li class="toctree-l2"><a class="reference internal" href="update-searxng.html">SearXNG maintenance</a></li>
  224. <li class="toctree-l2"><a class="reference internal" href="answer-captcha.html">Answer CAPTCHA from server’s IP</a></li>
  225. <li class="toctree-l2"><a class="reference internal" href="searx.favicons.html">Favicons</a></li>
  226. <li class="toctree-l2"><a class="reference internal" href="searx.limiter.html">Limiter</a></li>
  227. <li class="toctree-l2"><a class="reference internal" href="api.html">Administration API</a></li>
  228. <li class="toctree-l2"><a class="reference internal" href="architecture.html">Architecture</a></li>
  229. <li class="toctree-l2"><a class="reference internal" href="plugins.html">List of plugins</a></li>
  230. <li class="toctree-l2"><a class="reference internal" href="buildhosts.html">Buildhosts</a></li>
  231. </ul>
  232. </li>
  233. <li class="toctree-l1"><a class="reference internal" href="../dev/index.html">Developer documentation</a></li>
  234. <li class="toctree-l1"><a class="reference internal" href="../utils/index.html">DevOps tooling box</a></li>
  235. <li class="toctree-l1"><a class="reference internal" href="../src/index.html">Source-Code</a></li>
  236. </ul>
  237. <h3>Project Links</h3>
  238. <ul>
  239. <li><a href="https://github.com/searxng/searxng/tree/master">Source</a>
  240. <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a>
  241. <li><a href="https://searx.space">Public instances</a>
  242. <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a>
  243. </ul><h3>Navigation</h3>
  244. <ul>
  245. <li><a href="../index.html">Overview</a>
  246. <ul>
  247. <li><a href="index.html">Administrator documentation</a>
  248. <ul>
  249. <li>Previous: <a href="installation.html" title="previous chapter">Installation</a>
  250. <li>Next: <a href="installation-scripts.html" title="next chapter">Installation Script</a></ul>
  251. </li>
  252. </ul>
  253. </li>
  254. </ul>
  255. <search id="searchbox" style="display: none" role="search">
  256. <h3 id="searchlabel">Quick search</h3>
  257. <div class="searchformwrapper">
  258. <form class="search" action="../search.html" method="get">
  259. <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
  260. <input type="submit" value="Go" />
  261. </form>
  262. </div>
  263. </search>
  264. <script>document.getElementById('searchbox').style.display = "block"</script>
  265. <div role="note" aria-label="source link">
  266. <h3>This Page</h3>
  267. <ul class="this-page-menu">
  268. <li><a href="../_sources/admin/installation-docker.rst.txt"
  269. rel="nofollow">Show Source</a></li>
  270. </ul>
  271. </div>
  272. </div>
  273. </div>
  274. <div class="clearer"></div>
  275. </div>
  276. <div class="footer" role="contentinfo">
  277. &#169; Copyright SearXNG team.
  278. </div>
  279. </body>
  280. </html>