Install With Docker Compose

Manage a persistent Lavik service with Docker Compose.

Before You Start

Run native Linux/amd64 or Linux/arm64 with a Linux 6.1+ kernel and io_uring enabled. Docker Desktop uses its Linux VM; allocate at least 2 CPUs and 2 GiB to that VM for this example. Do not use x86 emulation on an ARM Mac for the io_uring runtime. These examples build a local image from the Minimal beta.1 release, using kernel TCP and io_uring.

Use Docker Compose v2. Stop the plain Docker example before starting this service: both use host ports 6379 and 9100. Compose uses a separate project volume; it does not automatically reuse lavik-beta1-data.

Host ports bind to 127.0.0.1. This local evaluation has no password; do not expose it publicly. seccomp:unconfined permits io_uring where Docker’s default profile blocks it, and relaxes syscall filtering. The container still runs as a non-root user, drops capabilities and prevents privilege escalation. For shared or production hosts, use a reviewed io_uring-capable seccomp policy and configure authentication/TLS before allowing remote clients.

Prepare The Project

Copy Dockerfile And start.sh From The Docker Guide →

In that same new project directory, save the following as compose.yaml. Keep the project name consistent across commands so Compose reuses the same volume.

compose.yaml

Linux · bash
services:
  lavik:
    build: .
    image: lavik-local:0.1.0-beta.1
    ports:
      - "127.0.0.1:6379:6379"
      - "127.0.0.1:9100:9100"
    volumes:
      - lavik-data:/var/lib/lavik
    read_only: true
    tmpfs:
      - /tmp
    cap_drop: [ALL]
    security_opt:
      - no-new-privileges:true
      - seccomp:unconfined
    ulimits:
      memlock:
        soft: 536870912
        hard: 536870912
    mem_limit: 1g
    cpus: 2
    stop_grace_period: 60s
    healthcheck:
      test: ["CMD-SHELL", "test \"$$(redis-cli --raw PING)\" = PONG"]
      interval: 5s
      timeout: 3s
      retries: 24
      start_period: 10s
volumes:
  lavik-data:

The example reserves a 512 MiB data file and caps retained memory at 512 MiB. Choose capacity for your workload before the first start; never truncate an existing data file. The named volume holds both data and logs. Removing that volume deletes the database. Keep backups outside the volume.

Start And Connect

Run docker compose -p lavik-beta1 up -d --build --wait. Wait for the service to become healthy, then use docker compose -p lavik-beta1 exec -T lavik redis-cli PING. It should return PONG. Use the same exec prefix with SET greeting "hello from Lavik" and GET greeting. The container health check verifies that the service answers PING; it does not assess application latency or capacity.

Operate The Service

Use docker compose -p lavik-beta1 ps and docker compose -p lavik-beta1 logs --tail 100 lavik to inspect the service. Use docker compose -p lavik-beta1 restart lavik for a graceful restart. docker compose -p lavik-beta1 down removes containers and the project network but retains the database volume; repeat up -d --wait to restore the service. Do not add --volumes or -v unless you intend to delete the database. Keep the same project directory and project name.

This is a standalone service, not a high-availability cluster. For Meta-managed primary/follower deployment, use the separate cluster guide.

Primary–Follower HA →