2026-12-04 · kavita · docker · self-hosting · media
Self-Host Kavita with Docker: A Fast Reading Server for Comics and Ebooks
Deploy Kavita, the fast self-hosted ebook, manga, and comic server, with Docker Compose. Includes reverse proxy, HTTPS, backups, and hardening tips.
- Total RAM
- 361.2 MB
- Startup
- 70.4 s
- Port
- 5000
- HTTP
- 200
What Kavita does and what it needs
Kavita is a self-hosted reading server for comics, manga, and ebooks. It scans your library folders, extracts metadata, and serves responsive web readers for CBZ, CBR, ZIP, RAR, 7zip, EPUB, and PDF files. You get collections, reading lists, user roles, age restrictions, and dark mode out of the box.
The upstream project does not publish a minimum memory figure. Practical usage depends on library size and concurrent readers: idle scans are light, but large metadata refreshes and image extraction can spike CPU and RAM. Start with 1 vCPU and 1 GB of RAM for a small library, and scale up if you plan to host thousands of volumes or many simultaneous users.
Kavita stores its database and configuration in /kavita/config. Your media lives wherever you mount it, typically /manga and /books. The container listens on port 5000 by default.
Prerequisites, ports, and volume constraints
You need Docker Engine 24+ and the Docker Compose plugin. Create two host directories before starting: one for Kavita’s config and one for your reading material. The config directory must be writable by the container user; Kavita runs as root by default in the official image, so a simple mkdir -p is enough.
Port 5000 is the only exposed port. Bind it to 127.0.0.1 so the app is not reachable over plain HTTP on your public IP. A reverse proxy will terminate TLS and forward traffic to that loopback address.
Volumes:
./kavita-config:/kavita/config— database, logs, and settings. Back this up../library:/manga— comics and manga. Read-only is fine../books:/books— ebooks. Read-only is fine.
If you run Kavita on a NAS or a host with SELinux, add :Z to the bind mounts or ensure the directories are readable by the container.
Production Docker Compose setup
Create the project directory and the compose file:
mkdir -p kavita && cd kavita
mkdir -p kavita-config library books
cat <<'EOF' > compose.yml
services:
kavita:
image: kizaing/kavita:latest
container_name: kavita
restart: unless-stopped
ports:
- "127.0.0.1:5000:5000"
volumes:
- ./kavita-config:/kavita/config
- ./library:/manga:ro
- ./books:/books:ro
environment:
- TZ=${TZ:-UTC}
EOF
Create a .env file for the timezone. Kavita does not require a database password or application secret; authentication is handled inside the app after first-run setup.
cat <<'EOF' > .env
TZ=UTC
EOF
Start the stack:
docker compose up -d
docker compose logs -f kavita
Open http://127.0.0.1:5000 from the host, or tunnel it over SSH: ssh -L 5000:127.0.0.1:5000 user@your-vps. The first visit asks you to create an admin account. Do that immediately, before exposing the service through a proxy.
Reverse proxy, HTTPS, and first-run hardening
Kavita serves a web UI and API over HTTP. It does not need WebSocket upgrade headers for normal reading, but large chapter downloads and image requests benefit from a generous body size limit. Set client_max_body_size 100M; in Nginx or the equivalent in Caddy. Forward X-Forwarded-Proto and X-Forwarded-For so Kavita logs the real client IP.
Nginx example:
server {
listen 443 ssl http2;
server_name kavita.example.com;
ssl_certificate /etc/letsencrypt/live/kavita.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/kavita.example.com/privkey.pem;
client_max_body_size 100M;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Caddy equivalent:
kavita.example.com {
reverse_proxy 127.0.0.1:5000
request_body {
max_size 100MB
}
}
After the proxy is live, log in as the admin and create a non-admin account for daily reading. Disable open registration if you do not want strangers creating accounts. Kavita’s user management lets you restrict library access per user, which is the right control for sharing with friends and family.
Updating, backups, and common pitfalls
Update the image and recreate the container:
docker compose pull
docker compose up -d
Back up the config volume before every update. The database lives in ./kavita-config:
tar -czf kavita-config-$(date +%F).tar.gz kavita-config
Your media directories are separate; back them up with your normal file backup tool. If you use named volumes instead of bind mounts, replace the path with docker run --rm -v kavita_kavita-config:/data -v $(pwd):/backup alpine tar czf /backup/kavita-config.tar.gz -C /data ..
Two pitfalls from the docs and issue tracker:
- Nightly vs stable. The
:latesttag tracks stable releases. The:nightlytag is bleeding edge and can change database schema or behavior between pulls. Pin to a specific version tag in production if you need reproducibility. - Library permissions. If Kavita scans zero files, the container cannot read your mounted media. Check that the host directories are world-readable or that the container user has access. Read-only mounts are fine, but the config directory must be writable.
Kavita is beta software until 1.0. Keep backups current and read release notes before jumping versions.
Measured in our sandbox run: total memory 361.2 MB (sum of per-container peaks over a 30s idle window after startup) across 1 container; largest container 361.2 MB; published port(s) 5000; HTTP probe returned 200. The run took 70.4s including the image download.
Verification: we ran this docker-compose stack in a disposable Docker environment and recorded the measurements above. They describe that run, not a guarantee for your host.