How to Install CapRover on Ubuntu 24.04 — Self-Hosted Heroku Alternative
Quick Summary
CapRover is an open-source Platform-as-a-Service (PaaS) built on Docker Swarm that lets you deploy apps, databases, and services with a single command or a git push. This guide walks you through installing CapRover on Ubuntu 24.04, pointing a wildcard domain at it, deploying your first app, and enabling automatic HTTPS via Let's Encrypt. Estimated time: 15 minutes.
>
Skip the setup? Use our 1-click CapRover installer — we provision a fully configured CapRover node with wildcard DNS preset in under 2 minutes.
Table of Contents
- What is CapRover?
- CapRover vs Coolify vs Dokploy
- Why Self-Host CapRover?
- Prerequisites
- Step 1: Update System and Open Firewall Ports
- Step 2: Install Docker
- Step 3: Run the CapRover One-Liner
- Step 4: Verify captain-01 Is Running
- Step 5: Install the CapRover CLI
- Step 6: Run the Captain Setup Wizard
- Step 7: Enable HTTPS with Let's Encrypt
- Deploy Your First App from a Docker Image
- Deploy an App from Git
- One-Click Apps: WordPress, Ghost, Redis, Postgres
- Environment Variables and Persistent Volumes
- Scaling Replicas and the Managed Nginx Layer
- Backups and Updates
- Troubleshooting
- FAQ
- Next Steps
What is CapRover?
CapRover is a free, open-source Platform-as-a-Service that sits on top of Docker Swarm and Nginx to give you a Heroku-like developer experience on your own hardware. You push code from Git or upload a tarball, CapRover builds a Docker image using your Dockerfile (or a language-specific Captain Definition), rolls the new image out across the swarm, and Nginx reverse-proxies traffic to healthy containers. The whole thing is controlled from a web dashboard at captain.yourdomain.com or from a cross-platform CLI written in Node.js.
What makes CapRover different from a bare Docker host is the opinionated glue around it: automatic Let's Encrypt certificates for every app, a one-click app marketplace with over 100 curated images (WordPress, Ghost, MongoDB, Postgres, Redis, MinIO, Gitea, n8n, Metabase, and more), a managed Nginx template you can override per-app, and built-in webhooks that trigger a rebuild whenever you push to a branch. You can scale any app to multiple replicas, mount persistent volumes for stateful workloads, and inject environment variables without rebuilding the image.
CapRover has been around since 2017 and is one of the most battle-tested self-hosted PaaS projects. It powers thousands of small businesses, indie hackers, and internal platforms because it is simple enough to run on a 1 GB VPS yet capable enough to manage a 10-node production cluster.
CapRover vs Coolify vs Dokploy
All three projects aim to be the "self-hosted Heroku," but they make different trade-offs:
| Feature | CapRover | Coolify | Dokploy |
|---|---|---|---|
| Backend | Docker Swarm | Docker + Compose | Docker Swarm + Compose |
| Minimum RAM | 1 GB | 2 GB recommended | 2 GB recommended |
| Wildcard DNS required | Yes | No (per-app subdomain OK) | No |
| One-click apps | 100+ curated | 100+ via Docker Compose templates | Growing catalog |
| Git-push deploy | Yes, via webhook | Yes, native GitHub/GitLab/Gitea app | Yes, native |
| UI maturity | Functional, utilitarian | Modern, polished | Modern, polished |
| Multi-server | Yes (Swarm join) | Yes (remote Docker hosts) | Yes (remote Docker hosts) |
| License | Apache 2.0 | Apache 2.0 | Apache 2.0 |
| Best for | Rock-solid simplicity, Swarm scaling | Polished UX, lots of integrations | Modern alternative, Compose-first workflow |
Why Self-Host CapRover?
- Full data ownership — your code, databases, and secrets stay on your server
- No vendor lock-in — CapRover deploys standard Docker images; you can walk away any time
- Cost savings — runs comfortably on an EUR 7.99/mo VPS vs USD 25+/mo per Heroku dyno, or USD 20+/mo for a comparable Render team
- Unlimited apps — deploy as many apps as your RAM can hold, no per-app pricing
- Automatic HTTPS — every app gets a free Let's Encrypt certificate without touching
certbot - Git-push deploys — mimic the Heroku workflow with a simple webhook per app
Prerequisites
Before you begin, you need:
- A VPS with at least 1 vCPU, 1 GB RAM, 20 GB storage
- Ubuntu 24.04 LTS (fresh install recommended)
- SSH access with a non-root sudo user (How to connect via SSH)
- A domain name with wildcard DNS — you must create an
Arecord for*.caprover.yourdomain.compointing to your server's public IP. CapRover gives every app a subdomain, so wildcard DNS is not optional. - Ports 80, 443, 3000, 996, 7946, 4789, and 2377 open on the firewall (more on this below)
Step 1: Update System and Open Firewall Ports
sudo apt update && sudo apt upgrade -y
sudo apt install -y ufw curlCapRover needs several ports: 80 and 443 for HTTP/HTTPS traffic, 3000 for the initial captain-01 verification, 996 for CapRover's WebSocket API, and 7946/4789/2377 for Docker Swarm overlay networking.
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 3000/tcp
sudo ufw allow 996/tcp
sudo ufw allow 7946/tcp
sudo ufw allow 7946/udp
sudo ufw allow 4789/udp
sudo ufw allow 2377/tcp
sudo ufw --force enableStep 2: Install Docker
CapRover requires Docker 24.x or newer. Install it from the official Docker repo so you get the latest stable release:
curl -fsSL https://get.docker.com | sudo sh
sudo usermod -aG docker $USER
newgrp docker
docker --versionExpected output:
Docker version 27.3.1, build ce12230If you plan to run CapRover on a single node, Docker is enough. If you want a multi-node cluster later, you can run docker swarm init now — CapRover will detect and reuse the existing swarm.
Step 3: Run the CapRover One-Liner
The official installer pulls the caprover/caprover image and wires it to the host's Docker socket so it can orchestrate containers:
docker run -p 80:80 -p 443:443 -p 3000:3000 \
-e ACCEPTED_TERMS=true \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /captain:/captain \
caprover/caproverThe command publishes three ports, mounts the Docker socket so CapRover can create swarm services, and mounts /captain on the host for persistent configuration. The first run takes 60-90 seconds while the swarm initialises and the dashboard image is pulled.
You will see log lines ending with:
CapRover is ready on port 3000!!Press Ctrl+C to detach — CapRover keeps running because the installer launches detached background services. If you prefer an explicit detached container, add -d to the docker run command.
Step 4: Verify captain-01 Is Running
Open a browser and go to http://YOUR_SERVER_IP:3000. You should see the CapRover login screen asking for the default password captain42. If the page loads, the captain-01 service is healthy. Close the browser tab — you will do the real configuration from the CLI in the next step, not this temporary port-3000 UI.
From the terminal you can also confirm the swarm service:
docker service lsExpected output:
ID NAME MODE REPLICAS IMAGE PORTS
abc123def captain-captain replicated 1/1 caprover/caprover:latestStep 5: Install the CapRover CLI
The CLI is the recommended way to run the setup wizard, deploy apps, and manage secrets. Install Node.js 20 and the CLI globally:
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install -g caprover
caprover --versionExpected output:
2.4.0You can run the CLI from your laptop too — it talks to the server over HTTPS on port 443 (or HTTP on 3000 during initial setup).
Step 6: Run the Captain Setup Wizard
Point your wildcard DNS at the server before running the wizard. With the A record for *.caprover.yourdomain.com propagated, run:
caprover serversetupThe wizard asks a series of questions:
caprover.yourdomain.com (no wildcard, no http://)captain42prod-caproverBehind the scenes the wizard does four things:
- Changes the admin password
- Sets the root domain, which tells CapRover that every app should be served under
*.caprover.yourdomain.com - Requests a wildcard Let's Encrypt certificate
- Force-enables HTTPS, so port 3000 is no longer needed
sudo ufw delete allow 3000/tcpFrom now on you access the dashboard at https://captain.caprover.yourdomain.com with your new password.
Step 7: Enable HTTPS with Let's Encrypt
If the wizard did not enable HTTPS (for example, you chose to skip it), you can enable it manually from the dashboard:
https://captain.caprover.yourdomain.comEvery app you create from now on automatically inherits HTTPS. If an app uses a custom domain, CapRover requests a dedicated cert for that domain too, again with zero configuration.
Deploy Your First App from a Docker Image
The fastest way to test CapRover is to deploy a pre-built image. From the dashboard:
hello-world and click Create New Appcaprover/docker-getting-startedWithin 10 seconds the container is running and reachable at https://hello-world.caprover.yourdomain.com.
Or do the same from the CLI:
caprover deploy --appName hello-world --imageName caprover/docker-getting-startedDeploy an App from Git
CapRover supports two Git workflows: push-based (you push to a repo and a webhook triggers the build) and pull-based (CapRover clones the repo on demand).
Push-based with a webhook:
git push to the selected branch triggers a rebuildCLI-based from a local checkout:
cd my-node-app
caprover deployThe CLI tars the working directory, uploads it to CapRover, and triggers a build. Your repo needs either a Dockerfile at the root or a captain-definition JSON file that points to a template (/dockerfile-nodejs-12, /dockerfile-python-3.8, etc.).
Example captain-definition for a Node.js app:
{
"schemaVersion": 2,
"templateId": "node/20"
}One-Click Apps: WordPress, Ghost, Redis, Postgres
CapRover's one-click marketplace is the fastest way to spin up production-ready services. From the dashboard:
CapRover chains the required services together — a WordPress install, for example, creates a MariaDB container, a WordPress container, links them over an internal overlay network, and exposes only the WordPress container to the outside world.
To deploy Redis from the CLI:
caprover api --path "/user/apps/appDefinitions/redis" \
--method "POST" \
--data '{"appName":"my-redis","hasPersistentData":true}'Environment Variables and Persistent Volumes
Every app has an App Configs tab where you manage environment variables and persistent volumes.
Environment variables are injected at container start. Add them as KEY=value pairs, then click Save & Update to roll the app with the new values. Use this for database URLs, API keys, and feature flags. Variables are stored encrypted in /captain/data/config-captain.json.
Persistent volumes survive container restarts and rebuilds. For a stateful app like Postgres or Ghost, add a volume mapping such as:
- Path in app:
/var/lib/postgresql/data - Label (recommended):
postgres-data
/captain/data/ on the host. Back up this directory and you back up all app state.You can also mount specific host paths if you need to share files between the host and the container, but labels are preferred because they are portable across nodes in a swarm.
Scaling Replicas and the Managed Nginx Layer
To scale an app horizontally, open the app, go to App Configs, and change Instance Count from 1 to 3 (or whatever you need). CapRover rolls out the additional replicas across the swarm, and the managed Nginx layer round-robins traffic between them. Downtime is zero because Nginx waits for a new replica to be healthy before retiring the old one.
The managed Nginx runs as a swarm service called captain-nginx and reloads automatically whenever you add, remove, or update an app. Its config is generated from a template you can override per-app in HTTP Settings → Edit Default Nginx Configurations. This is the escape hatch for WebSockets, large uploads, custom cache headers, or rate limits.
If you need to force a reload manually:
docker service update --force captain-captainBackups and Updates
Backups — everything CapRover needs to restore a node lives in /captain on the host. A nightly tarball is enough:
sudo tar czf /backup/caprover-$(date +%F).tar.gz /captainShip the tarball to S3, Backblaze B2, or a second VPS with rclone or restic on a cron. To restore on a new server, install Docker, stop the default CapRover container, replace /captain with your backup, and run the installer again — CapRover picks up where you left off.
Updates — from the dashboard go to Settings → Update CapRover. CapRover pulls the latest image and restarts the captain service with no downtime for your apps. Major-version updates occasionally require manual steps documented in the release notes, so always read them first.
From the CLI:
caprover api --path "/user/system/versionInfo" --method "GET"
caprover api --path "/user/system/versionInfo" --method "POST" \
--data '{"latestVersion":"1.12.0"}'Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
caprover serversetup times out | Wildcard DNS not propagated | Wait 5-10 minutes and re-run, or test with dig *.caprover.yourdomain.com |
| App deploys but returns 502 | Container not listening on the expected port | Set Container HTTP Port in HTTP Settings to the port your app binds (e.g., 3000, 8080) |
| Let's Encrypt fails with rate-limit error | Too many cert requests for this domain | Wait 1 hour, then retry — Let's Encrypt allows 5 duplicate certs per week |
| Dashboard unreachable after update | Captain container crashed during upgrade | SSH in, run docker service ls, then docker service logs captain-captain |
Builds fail with no space left on device | Old build layers filling /var/lib/docker | Run docker system prune -af --volumes (careful — removes unused volumes) |
| App keeps restarting | Out-of-memory kills | Check docker stats, scale down replicas or upgrade the VPS RAM |
| Webhook from GitHub does nothing | Token expired or branch mismatch | Regenerate the token in the app's Deployment tab and re-paste the webhook URL |
FAQ
Q: What are the minimum server requirements for CapRover?
A: CapRover itself runs on 1 vCPU and 1 GB RAM, but that leaves almost nothing for your apps. For a real workload with two or three apps plus a database, go with at least 2 vCPU and 4 GB RAM. Our CloudCore Professional plan at EUR 7.99/mo (4 vCPU / 8 GB / 100 GB NVMe) is the sweet spot.
Q: Can I run CapRover alongside other services on the same VPS?
A: Technically yes, but CapRover wants exclusive use of ports 80 and 443 for its managed Nginx. If you have other services that need those ports, proxy them through a CapRover app instead of running them directly on the host.
Q: How do I update CapRover to the latest version?
A: Go to Settings → Update CapRover in the dashboard and click Update. Or from the CLI, use the /user/system/versionInfo API endpoint shown in the Backups and Updates section.
Q: Is there a Docker Compose installation option?
A: The official installer is the recommended path because it configures Docker Swarm, the captain service, and the persistent volume in one step. You can inspect the underlying Compose-equivalent by reading the caprover/caprover image Dockerfile, but there is no officially supported Compose install.
Q: Can CapRover manage multiple servers?
A: Yes. Run docker swarm join on additional nodes, then add them from Cluster → Add a New Node in the dashboard. CapRover schedules app replicas across the cluster automatically. Database containers should stay on a single node unless you pick a replication-aware image.
Q: How do I back up my CapRover data?
A: Tar the /captain directory nightly and ship it off-box with rclone or restic. That directory contains app configs, persistent volumes, and Let's Encrypt certificates — everything needed for a full restore.
Q: Does CapRover support custom domains per app?
A: Yes. In the app's HTTP Settings tab, click Connect New Domain, enter the domain (e.g., blog.example.com), and point a CNAME record at captain.caprover.yourdomain.com. CapRover issues a dedicated Let's Encrypt cert for the custom domain.
Next Steps
- How to Secure Your VPS with Fail2Ban — protect SSH and the CapRover dashboard from brute-force attacks
- How to Monitor with Uptime Kuma — deploy Uptime Kuma as a CapRover one-click app and monitor all your services
- How to Set Up Automated Backups — never lose a
/captaindirectory - How to Install Docker on Ubuntu 24.04 — deeper Docker reference if you want to understand what CapRover is managing under the hood
### Skip the Manual Install>
We offer CapRover as a 1-click app on all VPS plans.
Your server comes pre-configured with wildcard DNS, HTTPS enabled, and the CLI ready to deploy — production-ready in under 2 minutes.>
Deploy CapRover Now | Starting from EUR 7.99/mo | 172+ 1-click apps | 9 global locations