How to run a local Typesense server with Docker Compose

Bjorn Krolsavatar

Bjorn Krols

Published on
17 October 2021


version: "3"
    image: typesense/typesense:0.21.0
    entrypoint: sh -c "/opt/typesense-server --data-dir /data --api-key=local-typesense-api-key --enable-cors"
      - "8108:8108"
      - typesense-data:/data
    driver: local

At the time of writing, Typesense does not have a latest tag on the Docker Hub. You can find a list of all available tags here.

The enable-cors flag is specified so we can call the server from a frontend, using Instantsearch.js for example.

To start the service:

docker compose up -d

To check whether the server is running:

curl 'http://localhost:8108/keys' \
    -X GET \
    -H "X-TYPESENSE-API-KEY: local-typesense-api-key"

# Expected response: { "keys": [] }

To stop the service:

docker compose down

To stop the service and delete the volume:

⚠️ This will delete all your Typesense data

docker compose down --volumes

Subscribe to our newsletter

The latest news, articles, and resources, sent to your inbox weekly.

More like this