This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<p>The rest of this article is of interest only to those who want to create and
maintain their own Docker images.</p>
</aside>
<p>The sources are hosted at <aclass="reference external"href="https://github.com/searxng/searxng-docker">searxng-docker</a> and the container includes:</p>
<li><p>enables <aclass="reference internal"href="searx.limiter.html#limiter"><spanclass="std std-ref">limiter</span></a> to protect against bots</p></li>
<li><p>enables <aclass="reference internal"href="settings/settings_server.html#image-proxy"><spanclass="std std-ref">image proxy</span></a> for better privacy</p></li>
<li><p>enables <aclass="reference internal"href="settings/settings_ui.html#static-use-hash"><spanclass="std std-ref">cache busting</span></a> to save bandwidth</p></li>
</ul>
<hrclass="docutils"/>
<sectionid="get-docker">
<h2>Get Docker<aclass="headerlink"href="#get-docker"title="Link to this heading">¶</a></h2>
<p>If you plan to build and maintain a docker image by yourself, make sure you have
<aclass="reference external"href="https://docs.docker.com/get-docker/">Docker installed</a>. On Linux don’t
forget to add your user to the docker group (log out and log back in so that
mount volume <codeclass="docutils literal notranslate"><spanclass="pre">HOST:CONTAINER</span></code></p></li>
</ul>
</aside>
<p>The docker image is based on <aclass="extlink-origin reference external"href="https://github.com/searxng/searxng/blob/master/Dockerfile">git://Dockerfile</a> and available from
<aclass="reference external"href="https://hub.docker.com/r/searxng/searxng">searxng/searxng @dockerhub</a>. Using the docker image is quite easy, for
instance you can pull the <aclass="reference external"href="https://hub.docker.com/r/searxng/searxng">searxng/searxng @dockerhub</a> image and deploy a local
instance using <aclass="reference external"href="https://docs.docker.com/engine/reference/run/">docker run</a>:</p>
<p>Inside <codeclass="docutils literal notranslate"><spanclass="pre">${PWD}/searxng</span></code>, you will find <codeclass="docutils literal notranslate"><spanclass="pre">settings.yml</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">uwsgi.ini</span></code>. You
can modify these files according to your needs and restart the Docker image.</p>
<p>Use command <codeclass="docutils literal notranslate"><spanclass="pre">container</span><spanclass="pre">ls</span></code> to list running containers, add flag <aclass="reference external"href="https://docs.docker.com/engine/reference/commandline/container_ls">-a</a> to list
exited containers also. With <codeclass="docutils literal notranslate"><spanclass="pre">container</span><spanclass="pre">stop</span></code> a running container can be
stopped. To get rid of a container use <codeclass="docutils literal notranslate"><spanclass="pre">container</span><spanclass="pre">rm</span></code>:</p>
<p>This might remove all docker items, not only those from SearXNG.</p>
</aside>
<p>If you won’t use docker anymore and want to get rid of all containers & images
use the following <em>prune</em> command:</p>
<divclass="highlight-sh notranslate"><divclass="highlight"><pre><span></span>$<spanclass="w"></span>docker<spanclass="w"></span>stop<spanclass="w"></span><spanclass="k">$(</span>docker<spanclass="w"></span>ps<spanclass="w"></span>-aq<spanclass="k">)</span><spanclass="w"></span><spanclass="c1"># stop all containers</span>
$<spanclass="w"></span>docker<spanclass="w"></span>system<spanclass="w"></span>prune<spanclass="w"></span><spanclass="c1"># make some housekeeping</span>
$<spanclass="w"></span>docker<spanclass="w"></span>rmi<spanclass="w"></span>-f<spanclass="w"></span><spanclass="k">$(</span>docker<spanclass="w"></span>images<spanclass="w"></span>-q<spanclass="k">)</span><spanclass="w"></span><spanclass="c1"># drop all images</span>
</pre></div>
</div>
<sectionid="shell-inside-container">
<h3>shell inside container<aclass="headerlink"href="#shell-inside-container"title="Link to this heading">¶</a></h3>
<asideclass="sidebar">
<pclass="sidebar-title">Bashism</p>
<ulclass="simple">
<li><p><aclass="reference external"href="https://lwn.net/Articles/343924/">A tale of two shells: bash or dash</a></p></li>
<li><p><aclass="reference external"href="http://mywiki.wooledge.org/Bashism">How to make bash scripts work in dash</a></p></li>
<li><p><aclass="reference external"href="https://dev.to/bowmanjd/writing-bash-scripts-that-are-not-only-bash-checking-for-bashisms-and-testing-with-dash-1bli">Checking for Bashisms</a></p></li>
</ul>
</aside>
<p>Like in many other distributions, Alpine’s <aclass="reference external"href="https://wiki.ubuntu.com/DashAsBinSh">/bin/sh</a> is <aclass="extlink-man reference external"href="https://manpages.debian.org/jump?q=dash">dash</a>. Dash is meant to be
Compared to debian, in the Alpine image <aclass="extlink-man reference external"href="https://manpages.debian.org/jump?q=bash">bash</a> is not installed. The
<aclass="extlink-origin reference external"href="https://github.com/searxng/searxng/blob/master/dockerfiles/docker-entrypoint.sh">git://dockerfiles/docker-entrypoint.sh</a> script is checked <em>against dash</em>
<h2>Build the image<aclass="headerlink"href="#build-the-image"title="Link to this heading">¶</a></h2>
<p>It’s also possible to build SearXNG from the embedded <aclass="extlink-origin reference external"href="https://github.com/searxng/searxng/blob/master/Dockerfile">git://Dockerfile</a>:</p>
searxng/searxng 1.0.0-209-9c823800-dirty 49586c016434 13 minutes ago 308MB
searxng/searxng latest 49586c016434 13 minutes ago 308MB
alpine 3.13 6dbb9cc54074 3 weeks ago 5.61MB
</pre></div>
</div>
</section>
<sectionid="command-line">
<h2>Command line<aclass="headerlink"href="#command-line"title="Link to this heading">¶</a></h2>
<asideclass="sidebar">
<pclass="sidebar-title">docker run</p>
<p>Use flags <codeclass="docutils literal notranslate"><spanclass="pre">-it</span></code> for <aclass="reference external"href="https://docs.docker.com/engine/reference/run/#foreground">interactive processes</a>.</p>
</aside>
<p>In the <aclass="extlink-origin reference external"href="https://github.com/searxng/searxng/blob/master/Dockerfile">git://Dockerfile</a> the <aclass="reference external"href="https://docs.docker.com/engine/reference/builder/#entrypoint">ENTRYPOINT</a> is defined as