installation-docker.rst.txt 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. .. _installation container:
  2. ======================
  3. Installation container
  4. ======================
  5. .. _Docker 101: https://docs.docker.com/get-started/docker-overview
  6. .. _Docker cheat sheet (PDF doc): https://docs.docker.com/get-started/docker_cheatsheet.pdf
  7. .. _Podman rootless containers: https://github.com/containers/podman/blob/main/docs/tutorials/rootless_tutorial.md
  8. .. _DockerHub mirror: https://hub.docker.com/r/searxng/searxng
  9. .. _GHCR mirror: https://ghcr.io/searxng/searxng
  10. .. _Docker compose: https://github.com/searxng/searxng-docker
  11. .. sidebar:: info
  12. - `Docker 101`_
  13. - `Docker cheat sheet (PDF doc)`_
  14. - `Podman rootless containers`_
  15. .. important::
  16. Understanding container architecture basics is essential for properly
  17. maintaining your SearXNG instance. This guide assumes familiarity with
  18. container concepts and provides deployment steps at a high level.
  19. If you're new to containers, we recommend learning the fundamentals at
  20. `Docker 101`_ before proceeding.
  21. Container images are the basis for deployments in containerized environments,
  22. `Docker compose`_, Kubernetes and more.
  23. .. _Container installation:
  24. Installation
  25. ============
  26. .. _Container prerequisites:
  27. Prerequisites
  28. -------------
  29. You need a working Docker or Podman installation on your system. Choose the
  30. option that works best for your environment:
  31. - `Docker <https://docs.docker.com/get-docker/>`_ (recommended for most users)
  32. - `Podman <https://podman.io/docs/installation>`_
  33. In the case of Docker, you need to add the user running the container to the
  34. ``docker`` group and restart the session:
  35. .. code:: sh
  36. $ sudo usermod -aG docker $USER
  37. In the case of Podman, no additional steps are generally required, but there
  38. are some considerations when running `Podman rootless containers`_.
  39. .. _Container pulling images:
  40. Pulling images
  41. --------------
  42. .. note::
  43. DockerHub now applies rate limits to unauthenticated image pulls. If you
  44. are affected by this, you can use the `GHCR mirror`_ instead.
  45. The official images are mirrored at:
  46. - `DockerHub mirror`_
  47. - `GHCR mirror`_ (GitHub Container Registry)
  48. Pull the latest image:
  49. .. code:: sh
  50. $ docker pull docker.io/searxng/searxng:latest
  51. \.\. or if you want to lock in to a specific version:
  52. .. code:: sh
  53. $ docker pull docker.io/searxng/searxng:2025.6.3-b73ac81
  54. .. _Container instancing:
  55. Instancing
  56. ==========
  57. This section is intended for advanced users who need custom deployments. We
  58. recommend using `Docker compose`_, which provides a preconfigured environment
  59. with sensible defaults.
  60. Basic container instancing example:
  61. .. code:: sh
  62. # Create directories for configuration and persistent data
  63. $ mkdir -p ./searxng/config/ ./searxng/data/
  64. $ cd ./searxng/
  65. # Run the container
  66. $ docker run --name searxng --replace -d \
  67. -p 8888:8080 \
  68. -v "./config/:/etc/searxng/" \
  69. -v "./data/:/var/cache/searxng/" \
  70. docker.io/searxng/searxng:latest
  71. This will start SearXNG in the background, accessible at http://localhost:8888
  72. .. _Container management:
  73. Management
  74. ----------
  75. List running containers:
  76. .. code:: sh
  77. $ docker container list
  78. CONTAINER ID IMAGE ... CREATED PORTS NAMES
  79. 37f6487c8703 ... ... 3 minutes ago 0.0.0.0:8888->8080/tcp searxng
  80. Access the container shell (troubleshooting):
  81. .. code:: sh
  82. $ docker container exec -it --user root searxng /bin/sh -l
  83. 37f6487c8703:/usr/local/searxng#
  84. Stop and remove the container:
  85. .. code:: sh
  86. $ docker container stop searxng
  87. $ docker container rm searxng
  88. .. _Container volumes:
  89. Volumes
  90. =======
  91. Two volumes are exposed that should be mounted to preserve its contents:
  92. - ``/etc/searxng``: Configuration files (settings.yml, etc.)
  93. - ``/var/cache/searxng``: Persistent data (faviconcache.db, etc.)
  94. .. _Container environment variables:
  95. Environment variables
  96. =====================
  97. The following environment variables can be configured:
  98. - ``$SEARXNG_*``: Controls the SearXNG configuration options, look out for
  99. environment ``$SEARXNG_*`` in :ref:`settings server` and :ref:`settings
  100. general`.
  101. - ``$GRANIAN_*``: Controls the :ref:`Granian server options <Granian configuration>`.
  102. - ``$FORCE_OWNERSHIP``: Ensures mounted volumes/files are owned by the
  103. ``searxng:searxng`` user (default: ``true``)
  104. Container internal paths (don't modify unless you know what you're doing):
  105. - ``$CONFIG_PATH``: Path to the SearXNG configuration directory (default: ``/etc/searxng``)
  106. - ``$SEARXNG_SETTINGS_PATH``: Path to the SearXNG settings file (default: ``$CONFIG_PATH/settings.yml``)
  107. - ``$DATA_PATH``: Path to the SearXNG data directory (default: ``/var/cache/searxng``)
  108. .. _Container custom images:
  109. Custom images
  110. =============
  111. To build your own SearXNG container image from source (please note, custom
  112. container images are not officially supported):
  113. .. code:: sh
  114. $ git clone https://github.com/searxng/searxng.git
  115. $ cd ./searxng/
  116. # Run the container build script
  117. $ make container
  118. $ docker images
  119. REPOSITORY TAG IMAGE ID CREATED SIZE
  120. localhost/searxng/searxng latest b14e256bfc36 14 seconds ago 201 MB
  121. localhost/searxng/searxng 2025.5.1-b653119ab-dirty b14e256bfc36 14 seconds ago 201 MB
  122. localhost/searxng/searxng builder 7f334c752b41 20 seconds ago 765 MB
  123. ghcr.io/searxng/base searxng-builder 7d6b8a1bed4a 20 hours ago 625 MB
  124. ghcr.io/searxng/base searxng 29baf9ef13ef 20 hours ago 62.5 MB