Skip to main content

Tarantool

What is Tarantool?

Tarantool is an in-memory computing platform that combines a database with an embedded Lua application server, used for fast key-value and relational-style workloads plus custom server-side logic written in Lua.

Start Tarantool

./laradock start tarantool

Your data is created on first start and kept between restarts. Name any other services alongside it to start them together, for example to pair it with the admin web UI: ./laradock start tarantool tarantool-admin.

Stop Tarantool

Stopping just pauses the container; your data is safe:

./laradock stop tarantool

To delete the container entirely (the data on disk is still untouched, it lives under DATA_PATH_HOST):

./laradock remove tarantool

Configuration

All settings live in tarantool/defaults.env and can be overridden by adding the same line to your own .env:

VariableDefaultWhat it does
TARANTOOL_PORT3301Host-side port Tarantool is published on (host:container).

Lua scripts placed in tarantool/lua on your host are mounted into the container at /opt/tarantool.

Use the interactive console

./laradock exec tarantool console

Use the admin web UI

  1. Start the admin container too: ./laradock start tarantool tarantool-admin.
  2. Open http://localhost:8002 (or your custom TARANTOOL_ADMIN_PORT, see the Tarantool Admin page).
  3. Set Hostname to tarantool, your data then appears in the panel.

See the Tarantool documentation for query and Lua scripting reference.

Backup and restore

Tarantool persists its in-memory data to disk as snapshot (.snap) and write-ahead-log (.xlog) files under /var/lib/tarantool in the container, mapped to DATA_PATH_HOST/tarantool on your host. Backing up is a matter of forcing a fresh snapshot, then copying that folder.

Force a snapshot from the interactive console so the on-disk files reflect the current in-memory state:

./laradock exec tarantool console

Then, inside the console:

box.snapshot()

Copy the data directory to back it up:

cp -r "${DATA_PATH_HOST:-~/.laradock/data}/tarantool" ./tarantool-backup

Restore by stopping the container, replacing the data directory with your backup, then starting again:

./laradock stop tarantool
rm -rf "${DATA_PATH_HOST:-~/.laradock/data}/tarantool"
cp -r ./tarantool-backup "${DATA_PATH_HOST:-~/.laradock/data}/tarantool"
./laradock start tarantool

Start completely fresh (wipe all data)

To throw away everything and start Tarantool from a clean, empty state (⚠️ this permanently deletes all snapshots and logs in this container, back up first if you need anything):

./laradock stop tarantool
./laradock remove tarantool
rm -rf "${DATA_PATH_HOST:-~/.laradock/data}/tarantool"
./laradock start tarantool

DATA_PATH_HOST is whatever you have set in .env (~/.laradock/data by default), so the folder above is where Tarantool's data actually lives on your machine.

Talk to this from another Laradock project

Each Laradock project is its own isolated Docker network by default, so a second project's containers can't reach this Tarantool by container name out of the box. Easiest fix: publish the port (already done, TARANTOOL_PORT) and have the other project connect to your host machine's address instead of tarantool, for example host.docker.internal (Docker Desktop) on this project's TARANTOOL_PORT. Make sure the two projects use different TARANTOOL_PORT values if they're both running at once.

Common issues

  • Admin UI shows no data. It needs the hostname set explicitly to tarantool (the container name), not localhost, since it's connecting from inside another container.
  • App can't connect but the container is running. Confirm your client uses tarantool (the container name) as the host, not localhost or 127.0.0.1, those only work from your host machine, not from inside another container.
  • Port already in use on your host. Another local Tarantool (or another Laradock project) is already bound to 3301. Change TARANTOOL_PORT in .env and restart: ./laradock restart tarantool.
  • Lua scripts in tarantool/lua aren't picked up. The folder is mounted at /opt/tarantool inside the container; confirm your init logic actually loads from that path.

Need the admin panel? See Tarantool Admin. New to Laradock? Start at Getting Started.