Deployment10 min read

Deploy your applications with CapRover on a VPS

CapRover is an open-source PaaS that turns an Ubuntu VPS into a self-contained deployment platform: deployments via `git push` or the CLI, automatic Let's Encrypt SSL and a one-click application catalog. This guide goes beyond the basic install — it covers the `captain-definition` v2 format, GitHub Actions integration, scaling to a multi-node cluster and troubleshooting the most common errors reported in CapRover issues.

Why choose CapRover over a cloud PaaS

Deploying on a bare VPS means manually configuring Nginx, TLS certificates, Docker and restarts on every release. CapRover removes that friction: it relies on Docker Swarm to orchestrate your containers, generates Let's Encrypt certificates, and offers deployment via git push or a pre-built Docker image. Its One-Click Apps catalog covers WordPress, PostgreSQL, Redis, MongoDB, Ghost and over a hundred other services, each in its own container. Where Heroku or Render charge per dyno or per compute hour, CapRover runs on your VPS at your fixed monthly server cost — the natural option for developers and agencies who want PaaS productivity without the variable bill.

The concrete benefits of CapRover

  • Deploy via git push or caprover deploy without reconfiguring the server on each release.
  • Automatic, renewed Let's Encrypt SSL for every application domain and subdomain.
  • One-Click catalog: over 100 services (databases, CMS, DevOps tools) in a few clicks.
  • Native horizontal scaling via Docker Swarm: add worker nodes on the fly without changing your apps.
  • Web interface with live logs, environment variables, data persistence and Netdata monitoring.
  • Build webhooks integrable with GitHub Actions, GitLab CI or Bitbucket for full CI/CD.
  • One-click CapRover self-update from the dashboard, no server access needed.

Hardware and network prerequisites

CapRover reserves RAM for Docker Swarm and its build engine. A VPS with 2 GB of RAM and 1 vCPU is enough for personal projects and a few small apps; move up to 4 GB of RAM and 2 vCPU as soon as you host several apps with their databases. Plan for at least 30 GB of SSD, since each Docker build consumes temporary disk space. A wildcard domain is strongly recommended — for example *.apps.mydomain.com — so that CapRover generates subdomains on the fly for each app. Ports 80, 443 and 3000 (admin panel) must be open. Since version 1.14, CapRover requires Docker with a minimum API version of 1.43; version 1.14.1 fixed a compatibility issue introduced by Docker v29 which raised that minimum to 1.44. Check your version with docker version | grep API before any upgrade.

Install CapRover and deploy your first application

01

Launch the install in a single command

On a clean Ubuntu with no pre-installed Docker, run docker run -p 80:80 -p 443:443 -p 3000:3000 -v /var/run/docker.sock:/var/run/docker.sock -v /captain:/captain caprover/caprover. CapRover initializes Docker Swarm and starts its admin panel on port 3000. The Docker image installs everything automatically — no dependencies to pre-install.

02

Configure the wildcard domain

Create a wildcard A DNS record pointing *.apps.mydomain.com to your VPS IP. In the admin panel (http://YOUR_IP:3000), enter this root domain. CapRover uses it as the suffix for all your apps and enables HTTPS via Let's Encrypt in one click.

03

Install the CLI and log in

On your development machine: npm install -g caprover then caprover login. Provide the URL https://captain.apps.mydomain.com and the password set in the previous step. The CLI saves the connection for subsequent deployments. If you have enabled two-factor authentication, use an app token instead of the password.

04

Prepare the captain-definition file

Add a captain-definition file at the root of your project. The v2 format (recommended) is just two lines: { "schemaVersion": 2, "dockerfilePath": "./Dockerfile" }. To deploy a pre-built Docker image instead of building from source, replace dockerfilePath with "imageName": "your-image:tag". The v1 format with dockerfileLines is still supported but considered legacy.

05

Create the app and deploy

In the panel, create an application named my-api. Then from your Git repository: caprover deploy. CapRover builds the image according to your captain-definition, sends it to Docker Swarm and exposes the app at https://my-api.apps.mydomain.com. For zero-downtime deploys, CapRover only switches traffic after the new container passes its health checks.

06

Add a database and persist data

From the One-Click Apps tab, install PostgreSQL. CapRover creates the database in a dedicated container and generates the environment variables (POSTGRES_PASSWORD, POSTGRES_HOST…). Link your application via these variables in the App Configs tab, then enable a Persistent Directory in the dedicated tab so data survives redeployments. Volumes are stored under /var/lib/docker/volumes/captain--VOLUME_NAME/_data on the host.

Integrating CapRover into a GitHub Actions CI/CD pipeline

CapRover exposes a build webhook per application, accessible in the Deployment tab of each app. This webhook triggers a full deployment on each HTTP POST call. To integrate with GitHub Actions, store three secrets in your repository: CAPROVER_SERVER (your instance URL), APP_NAME (the CapRover app name) and APP_TOKEN (the deployment token shown in the Deployment tab). An official action is available on the GitHub Marketplace (caprover/deploy-from-github): it handles building the deployment tar and sending it to CapRover in a single step. A minimal job example: after npm run build producing a dist/ folder, create an archive containing dist/ and your captain-definition, then call the action with your three secrets. The webhook + GitHub Actions combination replaces the local CLI for teams: a push to main triggers an automatic deployment, no server access key is shared among developers.

Scaling to a multi-node cluster with Docker Swarm

CapRover runs natively on Docker Swarm: adding capacity is done from the panel without reconfiguring your apps. In the Cluster menu, enter the IP of the new node, the associated root SSH key and the IP of your primary node as seen from the new node. CapRover installs Docker on the target and joins it to the Swarm. One important constraint: cluster mode requires a default Docker registry, because the primary node must push built images to worker nodes. CapRover offers to deploy one automatically. Another constraint to know: apps with a Persistent Directory enabled can only run on a single node (Docker Swarm does not share file volumes between hosts). To scale a stateful app, use an external database or an object storage service.

Backing up your CapRover instance

CapRover offers a native backup from the panel: Settings → Export Backup. The produced archive contains the configuration of all your apps, environment variables and Nginx settings. It does not contain the data from persistent volumes. To back up a PostgreSQL database hosted via One-Click, the recommended approach is a cron-scheduled pg_dump archived to external storage. Docker volumes are accessible under /var/lib/docker/volumes/; a copy of these folders, with the database stopped, is a low-level backup. Always test restoration on a staging VPS before relying on a backup in production.

Troubleshooting: the most common errors

Here are the error messages actually encountered in GitHub issues and CapRover forums, with their causes and fixes.

Frequent errors and their fixes

  • 502 Bad Gateway on the panel or an app after deployment. Most frequent cause: the app is not binding to the right port. Check the containerHttpPort field in App Configs (must match the port your app listens on). For slow-starting apps, CapRover may activate the container before it is ready: increase the health check delay or add a CHECKS file at the project root. If the 502 affects the panel itself after a VPS restart, wait 60 seconds — the captain-captain service reinitializes at boot.
  • App build failed / Build took too long. The Docker builder was killed by the OOM killer (insufficient memory). Add 2 GB of swap: fallocate -l 2G /swapfile && chmod 600 /swapfile && mkswap /swapfile && swapon /swapfile. To persist swap, add /swapfile swap swap defaults 0 0 to /etc/fstab. For Node.js builds, set NODE_OPTIONS=--max-old-space-size=512 in environment variables to limit memory footprint.
  • Error: minimum supported Docker API is 1.43 (or 1.44). Docker v29 raised the minimum required API and broke CapRover instances earlier than 1.14.1. Update CapRover from the panel (Settings → Check for Updates) before updating Docker, or update CapRover first if Docker is already on v29.
  • Verification Failed during SSL setup. DNS records have not yet propagated, or port 80 is blocked by a firewall. Check port access with ufw status and wait for DNS propagation with dig +short *.apps.mydomain.com. Cloudflare in orange-proxy mode blocks Let's Encrypt HTTP-01 validation: switch DNS to gray (DNS-only) during certificate generation, or use a wildcard certificate via DNS-01.
  • caprover login fails with ECONNREFUSED. Port 3000 is not reachable from your machine. Check ufw allow 3000 on the server. If you have not yet configured a captain domain, point directly to the IP: http://YOUR_IP:3000. Once the root domain is set in the panel, the CLI URL becomes https://captain.apps.mydomain.com.
  • Deployment from GitHub in an infinite restart loop. Caused by a missing or malformed captain-definition, or a Dockerfile that does not exit cleanly. Check build logs via the panel or docker service logs captain--my-app. A missing CMD in the Dockerfile makes the container exit immediately, which CapRover interprets as a crash.

Lock down port 3000 to your fixed IP: ufw allow from YOUR_IP to any port 3000 && ufw deny 3000. Enable two-factor authentication in the panel (Settings → Two-Factor Auth) and generate one app token per project for CI/CD — never put the admin password in a GitHub secret. For RAM-heavy builds, add swap before upgrading your plan: 2 GB of swap on a 2 GB RAM VPS covers most Node/Python stacks. Enable Netdata (available in One-Click Apps) to monitor CPU, RAM and network directly from the CapRover panel without an external tool.

CapRover vs open-source PaaS alternatives

CriterionCapRoverDokkuCoolify
Web interfaceYes, full-featuredNo (CLI only)Yes, full-featured
DeploymentCLI, webhook, image`git push`Git, Docker, image
OrchestrationDocker SwarmDocker (standalone)Docker (standalone)
Multi-node clusterYes (native Swarm)NoPartial (experimental)
One-Click catalog100+ appsCLI plugins50+ templates
Minimum VPS RAM2 GB1 GB2 GB
In-panel self-updateYesVia CLI/scriptYes

Launch your CapRover PaaS today

With a ServOrbit Cloud VPS, you get a clean Ubuntu, a configurable wildcard domain and the resources needed to run CapRover and all your applications.

Need help?

Browse our help center and FAQ, or reach our team — callback, WhatsApp or email. Support in French, English and Arabic.