2026-12-06 · silverbullet · markdown · docker · self-hosting
SilverBullet Docker: Self-Host Your Markdown Knowledge Base
Run SilverBullet in Docker Compose: a Rust-powered, extensible Markdown knowledge base with Space Lua, served behind Caddy with HTTPS and persistent /data
- Total RAM
- 2.2 MB
- Startup
- 75.2 s
- Port
- 3000
- HTTP
- 307
What SilverBullet does and what it needs
SilverBullet is a self-hosted Markdown knowledge base. Every page is a plain .md file on disk, so your notes stay portable and versionable with git. On top of that plain folder it layers Space Lua scripting, slash templates, and a plug system, which is why it scales from a personal notebook to a team wiki with custom workflows. The server is a single Rust binary that serves the pre-built TypeScript client, the file/space HTTP API, auth, and a headless-Chrome runtime for server-side Lua.
Because it’s a single Go/Rust-style static binary with an embedded frontend, the runtime footprint is small. The upstream project does not publish a minimum memory figure, so treat sizing as workload-driven: idle single-user instances are light, while heavy Space Lua scripts, large spaces, or the headless-Chrome runtime for server-side Lua push memory up. For calibration against similar single-binary productivity tools, Vaultwarden idles around 7.0 MB (/vaultwarden-docker-compose-self-hosting/), Memos around 18.0 MB (/self-host-memos-docker-compose/), and Miniflux around 43.0 MB (/self-host-miniflux-docker/). See the full benchmarks for context. SilverBullet itself is not in that set, so no number is claimed here.
Prerequisites, ports, and volume constraints
- A Linux VPS with Docker Engine 24+ and the Compose v2 plugin.
- A DNS A/AAAA record pointing at the VPS if you want HTTPS (e.g.
notes.example.com). - Port 3000 is the container’s HTTP port. We bind it to
127.0.0.1:3000so only the reverse proxy on the same host can reach it. - One persistent volume:
silverbullet_data, mounted at/data. That directory is your space — every page, attachment, and config file lives there. Back it up; losing it means losing your notes. - No database, cache, or external service is required. SilverBullet is self-contained.
If you want to test without a domain, either SSH-tunnel (ssh -L 3000:127.0.0.1:3000 user@vps) or temporarily change the port mapping to "3000:3000" — but put it back behind the proxy before exposing it to the internet.
Production Docker Compose setup
Create a project directory and drop in the compose file:
mkdir -p ~/silverbullet && cd ~/silverbullet
cat <<'EOF' > compose.yml
services:
silverbullet:
image: ghcr.io/silverbulletmd/silverbullet:latest
container_name: silverbullet
restart: unless-stopped
ports:
- "127.0.0.1:3000:3000"
environment:
TZ: ${TZ:-UTC}
SB_USER: ${SB_USER:-}
volumes:
- silverbullet_data:/data
volumes:
silverbullet_data:
EOF
Now the .env. SB_HOSTNAME must match the public hostname you’ll serve from — cookies and generated links depend on it. SB_USER is optional; if you set it (user:password), SilverBullet skips the first-run setup screen and uses those credentials directly. Leave it empty to do first-run setup in the browser.
cat <<'EOF' > .env
TZ=UTC
SB_HOSTNAME=notes.example.com
# Optional: set to user:password to skip first-run setup
SB_USER=
EOF
chmod 600 .env
If you do set SB_USER, generate a strong password rather than typing one:
openssl rand -hex 24
Bring it up:
docker compose pull
docker compose up -d
docker compose logs -f silverbullet
You should see the server bind to port 3000 and log the data directory. The stack is now reachable only from 127.0.0.1:3000.
Reverse proxy, HTTPS, and first-run hardening
SilverBullet is a normal HTTP app behind a proxy — no WebSocket upgrade headers are required for the core editor, but the client does use long-lived HTTP requests, so disable proxy buffering and give generous read timeouts. Uploads (attachments, pasted images) go through the same origin, so raise the body size limit.
Caddy is the shortest path. /etc/caddy/Caddyfile:
notes.example.com {
encode zstd gzip
reverse_proxy 127.0.0.1:3000 {
flush_interval -1
}
request_body {
max_size 100MB
}
}
flush_interval -1 disables response buffering so streaming responses arrive promptly. Reload with sudo systemctl reload caddy.
Nginx equivalent:
server {
listen 443 ssl http2;
server_name notes.example.com;
ssl_certificate /etc/letsencrypt/live/notes.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/notes.example.com/privkey.pem;
client_max_body_size 100M;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off;
proxy_read_timeout 3600s;
}
}
First-run hardening: open https://notes.example.com in a browser. If SB_USER is unset, SilverBullet shows a setup screen where you create the initial account. Do that immediately after the proxy is live — anyone who reaches the URL before you do can claim the instance. If you’d rather avoid the window entirely, set SB_USER in .env before docker compose up -d and skip the browser setup. Either way, once you’re in, keep the instance behind HTTPS; the auth cookie is not marked secure over plain HTTP.
Updating, backups, and common pitfalls
Update to the latest image:
docker compose pull
docker compose up -d
docker compose logs --tail=50 silverbullet
Back up the space. The only state is the silverbullet_data volume:
docker run --rm \
-v silverbullet_silverbullet_data:/data \
-v "$PWD":/backup \
alpine tar czf /backup/silverbullet-$(date +%F).tar.gz -C /data .
(Volume name is <project>_silverbullet_data; confirm with docker volume ls | grep silverbullet.) Because pages are plain Markdown, you can also git init inside the volume via a one-off container and push to a private remote for versioned history.
Two pitfalls worth knowing:
SB_HOSTNAMEmismatch. If you change the domain but forget to updateSB_HOSTNAME, auth cookies and generated links point at the old host and logins silently fail. Update.env, thendocker compose up -dto recreate the container.- Editing files outside the app. SilverBullet caches space state in memory. If you
scporrsyncMarkdown files into the volume while the server is running, the UI won’t see them until you restart the container (docker compose restart silverbullet). Prefer editing through the web UI or thesbCLI.
Troubleshooting common Docker errors
502 Bad Gateway from Caddy or Nginx
The proxy is up but can’t reach the container. Confirm the container is running and bound to localhost:
docker compose ps
docker compose logs --tail=100 silverbullet
ss -ltnp | grep 3000
If ss shows nothing on 3000, the container crashed on startup — check logs for a data-directory or permission error. If it’s listening on 0.0.0.0:3000 instead of 127.0.0.1:3000, your compose.yml port mapping was edited; restore "127.0.0.1:3000:3000".
Login redirects to the wrong host or cookies don’t stick
This is almost always SB_HOSTNAME. Verify what the container actually sees:
docker compose config | grep -A2 SB_HOSTNAME
docker compose exec silverbullet env | grep SB_
The value must exactly match the hostname in the browser’s address bar (no scheme, no trailing slash). Fix .env, then docker compose up -d to recreate the container — restart won’t pick up env changes.
Notes disappeared after a restart
The /data volume isn’t mounted or points somewhere unexpected. Check:
docker compose config | grep -A3 volumes
docker volume ls | grep silverbullet
docker compose exec silverbullet ls -la /data
If /data is empty but you have a backup tarball, restore it into the named volume with a one-off alpine container before starting the stack. Never run the container without the volume mount — SilverBullet will happily write into the container’s ephemeral filesystem and lose everything on the next up -d.
Permission denied writing to /data
If you bind-mounted a host directory instead of using the named volume, the container user may not own it. Either switch back to the named volume (recommended) or fix ownership on the host path:
ls -ld /path/to/space
docker compose logs silverbullet | grep -i permission
With the named volume in this guide, this error shouldn’t occur — it’s a signal that someone swapped in a bind mount without matching UIDs.
Measured in our sandbox run: total memory 2.2 MB (sum of per-container peaks over a 30s idle window after startup) across 1 container; largest container 2.2 MB; published port(s) 3000; HTTP probe returned 307. The run took 75.2s with the image already cached; a fresh server also has to download it.
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.