123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- .. _installation docker:
- ===================
- Docker installation
- ===================
- .. _ENTRYPOINT: https:
- .. _searxng-docker: https:
- .. _[filtron]: https:
- .. _[morty]: https:
- .. _[caddy]: https:
- .. sidebar:: info
- - :origin:`Dockerfile`
- - `searxng/searxng @dockerhub <https:
- - `Docker overview <https:
- - `Docker Cheat Sheet <https:
- - `Alpine Linux <https:
- - Alpine's ``/bin/sh`` is :man:`dash`
- .. tip::
- If you intend to create a public instance using Docker, use our well
- maintained searxng-docker_ image which includes
- - :ref:`protection <searx filtron>` `[filtron]`_,
- - a :ref:`result proxy <searx morty>` `[morty]`_ and
- - a HTTPS reverse proxy `[caddy]`_.
- Make sure you have `installed Docker <https:
- on Linux, don't forget to add your user to the docker group (log out and log
- back in so that your group membership is re-evaluated):
- .. code:: sh
- $ sudo usermod -a -G docker $USER
- searxng/searxng
- ===============
- .. sidebar:: ``docker run``
- - `-\-rm <https:
- automatically clean up when container exits
- - `-d <https:
- detached container
- - `-v <https:
- mount volume ``HOST:CONTAINER``
- The docker image is based on :origin:`Dockerfile` and available from
- `searxng/searxng @dockerhub`_. Using the docker image is quite easy, for
- instance you can pull the `searxng/searxng @dockerhub`_ image and deploy a local
- instance using `docker run <https:
- .. code:: sh
- $ mkdir my-instance
- $ cd my-instance
- $ export PORT=8080
- $ docker pull searxng/searxng
- $ docker run --rm \
- -d -p ${PORT}:8080 \
- -v "${PWD}/searx:/etc/searx" \
- -e "BASE_URL=http://localhost:$PORT/" \
- -e "INSTANCE_NAME=my-instance" \
- searxng/searxng
- 2f998.... # container's ID
- Open your WEB browser and visit the URL:
- .. code:: sh
- $ xdg-open "http://localhost:$PORT"
- Inside ``${PWD}/searx``, you will find ``settings.yml`` and ``uwsgi.ini``. You
- can modify these files according to your needs and restart the Docker image.
- .. code:: sh
- $ docker container restart 2f998
- Use command ``container ls`` to list running containers, add flag `-a
- <https:
- exited containers also. With ``container stop`` a running container can be
- stoped. To get rid of a container use ``container rm``:
- .. code:: sh
- $ docker container ls
- CONTAINER ID IMAGE COMMAND CREATED ...
- 2f998d725993 searxng/searxng "/sbin/tini -- /usr/…" 7 minutes ago ...
- $ docker container stop 2f998
- $ docker container rm 2f998
- .. sidebar:: Warning
- This might remove all docker items, not only those from SearXNG.
- If you won't use docker anymore and want to get rid of all conatiners & images
- use the following *prune* command:
- .. code:: sh
- $ docker stop $(docker ps -aq) # stop all containers
- $ docker system prune # make some housekeeping
- $ docker rmi -f $(docker images -q) # drop all images
- shell inside container
- ----------------------
- .. sidebar:: Bashism
- - `A tale of two shells: bash or dash <https:
- - `How to make bash scripts work in dash <http:
- - `Checking for Bashisms <https:
- Like in many other distributions, Alpine's `/bin/sh
- <https:
- `POSIX-compliant <https:
- Compared to debian, in the Alpine image :man:`bash` is not installed. The
- :origin:`dockerfiles/docker-entrypoint.sh` script is checked *against dash*
- (``make tests.shell``).
- To open a shell inside the container:
- .. code:: sh
- $ docker exec -it 2f998 sh
- Build the image
- ===============
- It's also possible to build SearXNG from the embedded :origin:`Dockerfile`::
- $ git clone https:
- $ cd searx
- $ make docker.build
- ...
- Successfully built 49586c016434
- Successfully tagged searxng/searxng:latest
- Successfully tagged searxng/searxng:1.0.0-209-9c823800-dirty
- $ docker images
- REPOSITORY TAG IMAGE ID CREATED SIZE
- 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
- Command line
- ============
- .. sidebar:: docker run
- Use flags ``-it`` for `interactive processes
- <https:
- In the :origin:`Dockerfile` the ENTRYPOINT_ is defined as
- :origin:`dockerfiles/docker-entrypoint.sh`
- .. code:: sh
- docker run --rm -it searxng/searxng -h
- .. program-output:: ../dockerfiles/docker-entrypoint.sh -h
|