Skip to content

Docker basics for the Scholar Lens stack ​

A short guide for day-to-day work with scholarlens-stack.yml. Run every command from the repo root (the folder with scholarlens-stack.yml and .env), so Compose reads .env.

Words you will see ​

  • Image: a built, read-only package of a program (like an installer). docker compose build makes images.
  • Container: a running copy of an image. docker compose up creates and starts containers.
  • Service: one entry in the yml file (backend, worker, frontend, tts-gpu, ...). Compose runs one container per service.
  • Project: the group of containers from one yml file. Ours is called scholarlens (the name: line), so containers are named scholarlens-<service>-1.
  • Profile: optional services. tts, tts-gpu, reranker, searxng, sandbox only start when their profile is on. The root .env turns them on with COMPOSE_PROFILES=searxng,reranker,sandbox,tts-gpu.
  • Volume: storage that survives when a container is removed (the database, the library files, the voice model cache).

Save typing ​

Add this to ~/.bashrc once, then open a new terminal:

bash
alias sl='docker compose -f ~/Projects/ScholarLens/scholarlens-stack.yml --project-directory ~/Projects/ScholarLens'

Every docker compose -f scholarlens-stack.yml ... below can then be written sl ... (for example sl ps).

Look around ​

WhatCommand
What is running in this projectdocker compose -f scholarlens-stack.yml ps
Every container on the machinedocker ps
Follow the logs of some servicesdocker compose -f scholarlens-stack.yml logs -f backend worker
Last 100 log lines of the voicesdocker compose -f scholarlens-stack.yml logs --tail 100 tts-gpu
Open a shell inside a containerdocker compose -f scholarlens-stack.yml exec backend bash
Disk used by images and volumesdocker system df

Update only the app (backend, worker, frontend) ​

After you change code in backend/ or frontend/:

bash
docker compose -f scholarlens-stack.yml up -d --build --no-deps backend worker frontend
  • --build rebuilds the images from your current code.
  • --no-deps leaves everything else (Postgres, tts-gpu, reranker, ...) alone: it is not restarted or recreated.
  • Naming the services limits the command to them.

Only one part:

bash
docker compose -f scholarlens-stack.yml up -d --build --no-deps frontend
bash
docker compose -f scholarlens-stack.yml up -d --build --no-deps backend worker

The worker uses the backend's image, so rebuild them together.

The voice service (TTS) ​

Chatterbox on the GPU is the service tts-gpu; Kokoro on the CPU is tts. Use only one.

WhatCommand
Start or update itdocker compose -f scholarlens-stack.yml up -d --build tts-gpu
Restart it (same image)docker compose -f scholarlens-stack.yml restart tts-gpu
Stop it (keeps the container)docker compose -f scholarlens-stack.yml stop tts-gpu
Stop and remove itdocker compose -f scholarlens-stack.yml rm -sf tts-gpu
Its logsdocker compose -f scholarlens-stack.yml logs -f tts-gpu
Is it healthy?docker compose -f scholarlens-stack.yml ps tts-gpu

Naming a service on the command line starts it even when its profile is off in .env. The voice model files live in the tts_cache volume, so removing the container does not download them again.

Podcast videos (optional) ​

The video service makes an episode's video when someone asks for it (Download › Make a video), in the background, and sends a notice when it is ready. It is off unless you turn it on. The easy way is the installer, which keeps the choice in .env (VIDEO_EXPORT) and rebuilds and starts everything:

bash
./install.sh --video

(Windows: .\install.ps1 -Video; --no-video / -NoVideo turns it off.) By hand instead:

  1. In .env, add video to COMPOSE_PROFILES and set VIDEO_EXPORT=true.
  2. Build and start it, and restart the backend so it reads VIDEO_EXPORT:
bash
docker compose -f scholarlens-stack.yml up -d --build --no-deps video backend

Its image (about 2.7 GB) adds a headless Chromium to the backend's. Logs: docker compose -f scholarlens-stack.yml logs -f video.

Start, stop, everything ​

WhatCommand
Start or update the whole stackdocker compose -f scholarlens-stack.yml up -d --build --wait
Stop everything (keeps containers and data)docker compose -f scholarlens-stack.yml stop
Start them againdocker compose -f scholarlens-stack.yml start
Remove the containers (keeps data)docker compose -f scholarlens-stack.yml down
Remove containers and all datadocker compose -f scholarlens-stack.yml down -v (deletes the Library, chats, vectors; back up first)

up is safe to run again and again: it only recreates services whose image or settings changed.

"tts-gpu is already running" and similar errors ​

Common causes, and what to do:

  1. Run from another folder, or without -f scholarlens-stack.yml. Compose then reads a different file or no .env, sees a different project, and trips over the existing scholarlens-* containers or ports. Run from the repo root with -f scholarlens-stack.yml (or use the sl alias above).
  2. Port already in use (Bind for 127.0.0.1:5011 failed: port is already allocated). Something else holds the port: an old container, or a voice service started outside Docker. Find it: docker ps --filter publish=5011 and ss -ltnp | grep 5011. Stop the old one, then run up again.
  3. A container left over from an earlier run (Conflict. The container name ... is already in use). Remove the leftover: docker rm -f scholarlens-tts-gpu-1, then run up again.
  4. Both voice services on. tts and tts-gpu share the address tts:5010. Keep only one profile in COMPOSE_PROFILES (or choose with ./install.sh --tts=kokoro|chatterbox|none).

If you only wanted to update the app, you did not need to touch tts-gpu at all: use the --no-deps backend worker frontend command above.

Clean up disk space ​

bash
docker image prune

Removes old, unused image layers (safe). docker system prune also removes stopped containers and build cache. Never add --volumes unless you mean to delete data.