DiceDBDiceDB
Installation

Docker

Get started with DiceDB using Docker

The quickest and easiest way to start using DiceDB is with the official Docker image. It comes with everything pre-configured, so you can get up and running in seconds without worrying about setup details.

Quick Start

Run DiceDB with a single command:

docker run \
    --name dicedb-001 \
    -p 6379:6379 -v $(pwd)/data:/data/ \
    dicedb/dicedb

This command starts a DiceDB container with the spill module already enabled. By default, the spill module uses RocksDB and is configured with a maximum memory limit of 250MB.

What This Does

  • Creates a container named dicedb-001
  • Maps port 6379 from the container to your host
  • Mounts a local data directory for persistent storage
  • Runs the latest DiceDB image with default configuration

Custom Configuration

If you prefer not to use the defaults and want to explicitly configure DiceDB, you can run DiceDB with explicit configuration:

docker run \
    --name dicedb-001 \
    -p 6379:6379 -v $(pwd)/data:/data/ \
    dicedb/dicedb \
    dicedb-server \
      --port 6379 \
      --maxmemory 500mb \
      --protected-mode no \
      --loadmodule /usr/local/lib/lib-spill.so path /data/spill/ max-memory 262144000

This configuration sets:

  • DiceDB max memory limit to 500MB
  • Spill memory limit to 250MB (262144000 bytes)

Connecting to DiceDB

Once your container is running, you can connect to it using the DiceDB CLI:

# Using docker exec
docker exec -it dicedb-001 dicedb-cli

# Or using a local DiceDB CLI
dicedb-cli -h localhost -p 6379

Managing the Container

Stop the Container

docker stop dicedb-001

Start the Container

docker start dicedb-001

View Logs

docker logs dicedb-001

# Follow logs in real-time
docker logs -f dicedb-001

Remove the Container

docker rm dicedb-001

Data Persistence

The data directory mounted in the container ensures that your data persists across container restarts. Make sure to:

  • Keep the volume mount path consistent
  • Back up the data directory regularly
  • Ensure proper permissions on the host directory

On this page