Skip to content

Tutorial

How to install Uptime Kuma with Docker Compose and Caddy on a VPS

This tutorial installs Uptime Kuma 2.5.13 on an Ubuntu 24.04 VPS with Docker Compose and places it behind Caddy 2.11.9 with automatic HTTPS. Only ports 80 and 443 stay open on the host: Uptime Kuma's port 3001 is never published. The guide covers the 2.x first-boot database setup screen, admin onboarding, monitors (HTTP keyword, TLS certificate expiry, TCP port, and cron Push heartbeats), alerts, consistent SQLite WAL backups, a verified restore, and controlled upgrades. Everything was tested on December 4, 2026 on a clean Ubuntu 24.04.5 LTS (amd64) machine.

On this page
  1. Where to host Uptime Kuma
  2. Versions used
  3. What you need
  4. 1. Install Docker and configure the firewall
  5. 2. Create .env, Caddyfile, and docker-compose.yml
  6. 3. Validate, start, and verify exposed ports
  7. 4. Pick the database (2.x), create the admin, and enable Trust Proxy
  8. 5. Set up alerts before adding monitors
  9. 6. Create the three monitor types that catch real failures
  10. 7. Consistent backup and tested restore
  11. 8. Controlled upgrades
  12. Common issues
  13. What was outside the test
  14. Next steps

Architecture diagram of Uptime Kuma 2.5.13 behind Caddy 2.11.9 on an Ubuntu 24.04 VPS: only ports 80 and 443 are open on Caddy, which redirects HTTP to HTTPS and proxies WebSocket and Push API traffic over the internal Docker network to Uptime Kuma port 3001 using SQLite in WAL mode

Where to host Uptime Kuma

One operational rule matters before you start: do not rely solely on an Uptime Kuma instance running on the same VPS as the critical apps it monitors. If that server loses power, runs out of RAM, or drops off the network, Uptime Kuma goes down with it and no alert fires.

The cleaner setup is running Uptime Kuma on a separate small Linux VPS and monitoring your production websites, APIs, databases, and cron jobs from outside. If you only have one server right now, it is still useful for watching TLS certificates, webhooks, and external dependencies until you split monitoring onto its own box.

Versions used

Component Version Source
Uptime Kuma 2.5.13 (Dec 1, 2026) Uptime Kuma releases
Caddy 2.11.9 (Nov 5, 2026) Caddy releases
BusyBox (volume backup) 1.37.0 Docker Hub
Docker Engine 29.10.1 official apt repository
Docker Compose v5.8.1 (plugin) official apt repository
OS Ubuntu 24.04.5 LTS, amd64

Every image tag is pinned. Avoid :2 or :latest: the 2.x branch changed database initialization compared to 1.x, and the tool responsible for alerting you during outages should never upgrade itself unexpectedly.

What you need

  • A 64-bit Ubuntu 24.04 VPS with a sudo user (examples use deploy). If the server is brand new, start with First steps to secure an Ubuntu 24.04 VPS.
  • A subdomain with an A DNS record pointing to the VPS IPv4 address. Examples use status.example.com.
  • Ports 80 and 443 free on the VPS so Caddy can issue and renew the Let's Encrypt certificate.

In testing, Uptime Kuma used about 155 MiB of RAM at idle (166 MiB with three active monitors) and Caddy used 62 MiB, roughly 230 MiB combined. The stack fits comfortably on any Docker VPS tier.

1. Install Docker and configure the firewall

If Docker is not installed yet, set up the official docker.sources repository (covered in detail in How to install Docker and Docker Compose on Ubuntu 24.04):

bash
sudo apt-get update
sudo apt-get install -y ca-certificates curl ufw
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sudo tee /etc/apt/sources.list.d/docker.sources >/dev/null <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker "$USER"

Log out of SSH and log back in so the docker group takes effect, then verify both versions:

bash
docker version --format '{{.Server.Version}}'
docker compose version

Allow only SSH, HTTP, and HTTPS (TCP plus UDP for Caddy HTTP/3) in ufw:

bash
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 443/udp
sudo ufw enable
sudo ufw status verbose

Confirm with y when ufw enable prompts. Port 3001 stays out of ufw, and just as importantly stays out of ports: in Compose, because published Docker ports bypass ufw (see The Docker port stays open with ufw).

2. Create .env, Caddyfile, and docker-compose.yml

Create the project folder:

bash
mkdir -p ~/uptime-kuma && cd ~/uptime-kuma

Set your domain in .env (replace status.example.com with your subdomain):

.env
UPTIME_DOMAIN=status.example.com

Create Caddyfile. Caddy requests the Let's Encrypt certificate, redirects HTTP to HTTPS with 308 Permanent Redirect, and proxies both HTTP requests and Socket.IO WebSockets without extra headers:

Caddyfile
{$UPTIME_DOMAIN} {
	reverse_proxy uptime-kuma:3001
}

Create docker-compose.yml. Only caddy defines ports:; uptime-kuma lives exclusively on the internal proxy network:

docker-compose.yml
name: uptime-kuma

services:
  uptime-kuma:
    image: louislam/uptime-kuma:2.5.13
    restart: unless-stopped
    volumes:
      - uptime_kuma_data:/app/data
    networks:
      - proxy

  caddy:
    image: caddy:2.11.9
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    environment:
      UPTIME_DOMAIN: ${UPTIME_DOMAIN:?set UPTIME_DOMAIN in .env}
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
      - caddy_data:/data
      - caddy_config:/config
    networks:
      - proxy
    depends_on:
      - uptime-kuma

networks:
  proxy:

volumes:
  uptime_kuma_data:
  caddy_data:
  caddy_config:

3. Validate, start, and verify exposed ports

Validate both configuration files before starting the stack:

bash
cd ~/uptime-kuma
docker compose config -q && echo CONFIG_OK
docker run --rm --env-file .env -v "$PWD/Caddyfile:/etc/caddy/Caddyfile:ro" caddy:2.11.9 caddy validate --config /etc/caddy/Caddyfile

The second command must end with Valid configuration. Bring the containers up and check status:

bash
docker compose up -d
docker compose ps

In docker compose ps, caddy binds 0.0.0.0:80->80/tcp and 0.0.0.0:443->443/tcp (plus 443/udp), while uptime-kuma lists only 3001/tcp (container-internal, no host binding) and transitions to (healthy) within about a minute.

Confirm on the host that port 3001 is not listening:

bash
sudo ss -tulpn | grep -E ':(22|80|443|3001)\b'

Only SSH on 22 and docker-proxy on 80 and 443 should appear. Check the HTTP-to-HTTPS redirect and initial entry endpoint:

bash
curl -sSI http://status.example.com/ | head -n 5
curl -fsS https://status.example.com/api/entry-page

Expect HTTP/1.1 308 Permanent Redirect to https://status.example.com/ and:

json
{"type":"setup-database"}

4. Pick the database (2.x), create the admin, and enable Trust Proxy

Unlike the 1.x series, Uptime Kuma 2.5.13 opens with a database selection step. Until you finish setup and create the administrator, anyone reaching your subdomain can claim the instance; complete this immediately after docker compose up -d:

  1. Open https://status.example.com in your browser.
  2. On Setup Database, select Embedded SQLite and continue. For dozens or hundreds of monitors on a VPS, embedded SQLite is fast, easy to back up, and avoids a separate database container. External MariaDB only becomes useful when thousands of monitors write heartbeats concurrently.
  3. Wait a few seconds while Uptime Kuma writes db-config.json, creates kuma.db, and runs database migrations. The page reloads automatically to the admin account screen.
  4. Enter a username and a strong password (saved in a password manager), then click Create.

To confirm from the terminal that Socket.IO WebSocket handshakes pass cleanly through Caddy after database setup:

bash
curl -fsS "https://status.example.com/socket.io/?EIO=4&transport=polling" | head -c 120

The output begins with 0{"sid":"...","upgrades":["websocket"]....

Finish with two quick hardening tweaks in the UI:

  • Trust Proxy: go to Settings → Reverse Proxy, enable Trust Proxy, and save. Without it, Uptime Kuma logs Caddy's internal Docker IP (such as 172.18.0.3) instead of the visitor's real client IP.
  • 2FA: under Settings → Security, turn on TOTP two-factor authentication for the admin account.

5. Set up alerts before adding monitors

Configuring a default notification channel first means every monitor you add inherits alerting automatically.

Open Settings → Notifications → Setup Notification. Uptime Kuma ships with over 90 built-in providers; on a VPS, four cover most setups:

  • Telegram: create a bot via @BotFather, paste the Bot Token, send a message to the bot, and click Auto Get to fill Chat ID. Fast and reliable for solo ops or small team groups.
  • Discord or Slack: paste an Incoming Webhook URL for your alerts channel.
  • Email (SMTP): solid secondary channel and handy for certificate expiry reminders.
  • Generic Webhook (JSON): useful for feeding n8n workflows, custom scripts, or internal incident routing.

For whichever channel you pick:

  1. Enable Default enabled and Apply on all existing monitors.
  2. Click Test and confirm the test alert arrives before saving.

In our test against a local Webhook receiver, Test returned Sent Successfully. and stopping then restarting the monitored target triggered both JSON alerts automatically:

text
[TCP Demo 8080] [🔴 Down] Connection failed
[TCP Demo 8080] [✅ Up] 1 ms

6. Create the three monitor types that catch real failures

Click Add New Monitor. On a production VPS, three monitor types catch almost everything that silently breaks:

HTTP(S) Keyword monitor with TLS certificate expiry alerts

Checking only for HTTP 200 misses error pages served with status 200 or an API returning an empty body. Use HTTP(s) - Keyword:

  • URL: your app's health endpoint, such as https://api.example.com/health.
  • Keyword: a string that only appears in a valid response (for example ok).
  • Heartbeat Interval: 60 seconds for standard websites, or 20 to 30 seconds for critical APIs.
  • Retries: 2 or 3 with a 20-second retry interval to filter out brief network blips or container restarts during deploys.
  • Certificate Expiry Notification: keep enabled. Uptime Kuma inspects the TLS certificate and alerts at 7, 14, or 21 days (configurable in Settings → Notifications) if automatic renewal stops working.

TCP Port monitor

For non-HTTP services (SSH on another server, an SMTP relay, or a database/Redis port over a private VPN), create a TCP Port monitor with the hostname and port.

Push monitor for cron jobs and backups

Knowing your website responds does not prove your nightly backup actually ran. Create a Push monitor:

  1. Set the Heartbeat Interval to match your schedule (for example 86400 seconds for a daily backup, plus a small buffer).
  2. Copy the generated Push URL and append a curl ping to your cron script so it only fires on success (&&):
bash
/usr/local/bin/my-backup.sh && \
  curl -fsS -m 10 "https://status.example.com/api/push/YOUR_TOKEN?status=up&msg=OK&ping=" >/dev/null

In our test through Caddy over HTTPS, the Push call returned {"ok":true}. Once the interval elapsed without another heartbeat, Uptime Kuma fired:

text
[Backup Diario] [🔴 Down] No heartbeat in the time window

If you follow Automatic VPS backups with restic, adding this Push ping at the end of the systemd unit guarantees an alert if backups ever stop running quietly.

Public status pages and Prometheus metrics

  • Status page: under Status Pages → New Status Page, publish a clean public URL (such as https://status.example.com/status/production) exposing only selected monitors while keeping the admin panel private.
  • Prometheus metrics (/metrics): enabled and auth-protected by default (unauthenticated requests return 401). Scrape it with Basic Auth or create an API key under Settings → API Keys:
bash
curl -fsS -u "admin:YOUR_PASSWORD" https://status.example.com/metrics | grep '^monitor_status'

7. Consistent backup and tested restore

Uptime Kuma runs SQLite in WAL mode: while the container is running, recent writes live in /app/data/kuma.db-wal and /app/data/kuma.db-shm. Copying kuma.db live without pausing can produce a broken backup.

The cleanest Docker volume backup pauses uptime-kuma for a few seconds (letting SQLite flush the WAL cleanly), archives all of /app/data (kuma.db, db-config.json, and uploaded icons), and starts it back up:

bash
cd ~/uptime-kuma
mkdir -p ~/backups/uptime-kuma

docker compose stop uptime-kuma
docker run --rm \
  -v uptime-kuma_uptime_kuma_data:/data:ro \
  -v "$HOME/backups/uptime-kuma:/backup" \
  busybox:1.37.0 \
  tar czf "/backup/uptime-kuma-$(date +%F).tar.gz" -C /data .
docker compose start uptime-kuma

Copy the .tar.gz archive along with .env, Caddyfile, and docker-compose.yml off the VPS.

Restore onto a fresh volume (without Docker Compose warnings)

When restoring on a new server (or testing a wipe-and-restore), let Docker Compose create the volume first via docker compose create uptime-kuma. That preserves Compose's ownership labels so future docker compose up -d runs show zero external-volume warnings:

bash
cd ~/uptime-kuma
docker compose down
docker volume rm uptime-kuma_uptime_kuma_data
docker compose create uptime-kuma

docker run --rm \
  -v uptime-kuma_uptime_kuma_data:/data \
  -v "$HOME/backups/uptime-kuma:/backup:ro" \
  busybox:1.37.0 \
  sh -c 'rm -rf /data/* /data/.[!.]* && tar xzf /backup/uptime-kuma-2026-12-04.tar.gz -C /data'

docker compose up -d

In our clean VM test, Uptime Kuma came back online in 2 seconds after the restore with the admin login, all three monitors, and the Webhook channel intact and zero Compose warnings.

8. Controlled upgrades

Before upgrading, read the Uptime Kuma release notes and run the backup above. Then update the pinned tag in docker-compose.yml (the example moves from 2.5.12 to 2.5.13; substitute your current and target tags):

bash
cd ~/uptime-kuma
sed -i 's|louislam/uptime-kuma:2.5.12|louislam/uptime-kuma:2.5.13|' docker-compose.yml
docker compose config -q
docker compose pull uptime-kuma
docker compose up -d
docker compose logs --tail=30 uptime-kuma

Testing the upgrade from 2.5.12 to 2.5.13 recreated only the uptime-kuma container while Caddy kept running, returning to (healthy) in 7 seconds with every monitor and alert preserved.

Common issues

  • 502 Bad Gateway or Caddy failing to issue a certificate: verify your A DNS record resolves to the VPS IPv4, port 80 is reachable, and Caddyfile points to uptime-kuma:3001 on the shared proxy network. Walk through Fix Caddy 502 Bad Gateway and HTTPS errors with Docker.
  • required variable UPTIME_DOMAIN is missing a value: .env is missing, empty, or in a different directory. Run Compose commands from ~/uptime-kuma.
  • Dashboard stuck on "Connecting..." or reconnecting continuously: an upstream proxy (such as an orange-clouded CDN setting or a custom Nginx config) is blocking WebSockets on /socket.io/. With the direct Caddyfile above, WebSocket upgrades work out of the box.
  • Push monitor returns 404: the token in the URL does not match the monitor, or the monitor was paused/deleted.
  • SQLITE_BUSY or database is locked: almost always caused by placing /app/data on NFS or running two containers against the same volume.
  • Port 3001 reachable on the public IP despite ufw: ports: - "3001:3001" was left in docker-compose.yml. Remove ports: from uptime-kuma and run docker compose up -d.

What was outside the test

Testing ran inside an isolated Ubuntu 24.04.5 LTS virtual machine with no public IP. Real DNS propagation, public Let's Encrypt certificate issuance, and external HTTP/3 UDP traffic were not exercised; Caddy used tls internal with its local CA and the same reverse_proxy uptime-kuma:3001 block. Alerts were verified against a local Webhook receiver rather than external Telegram, Discord, or SMTP providers, and the RAM figures come from that VM as an order-of-magnitude reference.

Next steps