Install MeiliSearch Inside Docker Container in Linux

Install MeiliSearch Inside Docker Container in Linux

MeiliSearch is an open-source search engine written in the Rust programming language. This search engine provides customizable search and indexing, understands typos, supports full-text search, synonyms, and offers other features.

This tutorial explains how to install MeiliSearch inside a Docker container in the Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

Install MeiliSearch

  • Host network

Run the following command to create a container for MeiliSearch that uses host network:

docker run -d --name=meilisearch --restart=always --network=host \
    -v /opt/meilisearch/data:/meili_data \
    -e MEILI_MASTER_KEY=pwd123 \
    getmeili/meilisearch
  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, MeiliSearch service is listening on port 7700. It can be changed with -p option.

docker network create app-net
docker run -d --name=meilisearch --restart=always --network=app-net \
    -p 8080:7700 \
    -v /opt/meilisearch/data:/meili_data \
    -e MEILI_MASTER_KEY=pwd123 \
    getmeili/meilisearch

Note: don't forget to change master key.

Testing MeiliSearch

Send GET request to verify the status and availability of a Meilisearch service:

curl -H 'Authorization: Bearer pwd123' http://192.168.0.252:7700/health

Output:

{"status":"available"}

Uninstall MeiliSearch

To completely remove MeiliSearch, remove its container:

docker rm --force meilisearch

Remove MeiliSearch image:

docker rmi getmeili/meilisearch

You can also remove MeiliSearch data:

sudo rm -rf /opt/meilisearch

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.