How-To Last updated September 14, 2026

How to Self-Host n8n: Docker vs Cloud, Which Should You Choose?

Self-hosting n8n with Docker offers unlimited workflow executions and complete data privacy for a low monthly VPS cost ($5-$10/month). Using n8n Cloud eliminates server maintenance and setup complexity but incurs monthly usage fees. Choose Docker self-hosting if you have basic Linux skills and high automation volume, or n8n Cloud if you want instant setup with managed infrastructure.

Does this sound like your business?

TOTAL TIME30 minutes
TOOLS NEEDED
Ubuntu 22.04 LTS VPS Docker & Docker Compose Domain name with DNS access SSH terminal client

Automating your business workflows with self-hosted tools gives you total control over your data, execution limits, and infrastructure costs. If you want full control over your privacy and server resources, learning how to self-host n8n is one of the smartest infrastructure moves you can make. n8n is a source-available workflow automation platform (licensed under its own “fair-code” Sustainable Use License, not an OSI-approved open source one) that lets you connect APIs, run custom code, and deploy AI agents without per-execution charges. In this guide, we will compare self-hosting n8n using Docker against using n8n Cloud so you can choose the best deployment path for your business.

Diagram illustrating how to self-host n8n

Docker Self-Hosting vs n8n Cloud: Key Differences

Before launching a virtual server, you should understand the trade-offs between hosting n8n yourself and paying for n8n Cloud.

1. Cost and Scaling

n8n Cloud starts at a monthly fee with execution caps. For lightweight automation, Cloud is convenient. However, if you run high-volume data pipelines, process thousands of webhooks daily, or build complex AI workflows, Cloud costs scale quickly. Hosting n8n on a Virtual Private Server (VPS) via Docker costs as little as $5 to $10 per month for unlimited workflow executions.

2. Security and Data Ownership

Self-hosting ensures your credentials, API keys, and customer payload data remain inside your private network. This is critical for companies handling healthcare data, financial records, or strict GDPR requirements. When you self-host, your database stays on your infrastructure.

3. Maintenance Responsibility

With n8n Cloud, updates, database backups, security patches, and uptime are handled automatically. When you self-host n8n using Docker, you are responsible for maintaining Docker containers, backing up your PostgreSQL database, updating SSL certificates, and managing server security.

If you want to understand how n8n compares to cloud platforms like Zapier or Make before setting up infrastructure, read our detailed guide on n8n vs Zapier vs Make.

Step-by-Step Guide: How to Self-Host n8n with Docker

If you decide that self-hosting fits your technical capabilities and privacy requirements, follow these steps to deploy n8n using Docker Compose on a Linux VPS.

Step 1: Provision a Linux VPS and Configure DNS

Create a basic VPS running Ubuntu 22.04 LTS on cloud providers like DigitalOcean, Hetzner, or AWS. A server with 2 GB RAM and 1 vCPU is sufficient for most starter workloads. Once your server IP address is assigned, log into your DNS provider and create an ‘A’ record pointing your subdomain (e.g., n8n.yourdomain.com) to your server’s public IP address.

Step 2: Install Docker and Docker Compose

Connect to your VPS using SSH. Update system packages and install Docker alongside Docker Compose using standard repository packages.

Step 3: Create a Docker Compose File

Create a dedicated directory for your n8n setup and create a docker-compose.yml file. n8n uses SQLite by default, so a minimal compose file with just the n8n container and a persistent volume is enough to get running. PostgreSQL is optional, not required, and worth adding once you are scaling past a single small instance.

Refer to the official n8n hosting documentation for standard configuration variables. Configure environment variables like N8N_HOST, WEBHOOK_URL, and database credentials inside your compose file.

Step 4: Configure Reverse Proxy and SSL

n8n requires HTTPS to handle secure webhooks and OAuth connections from third-party services. Set up Caddy or Nginx with Let’s Encrypt to handle automatic SSL certificate issuance. Caddy simplifies this process because it automatically provisions and renews SSL certificates for your subdomain.

Step 5: Launch n8n and Complete Owner Setup

Start your stack using Docker Compose and navigate to your domain in your web browser. You will see the initial n8n setup screen where you create your admin owner account. Once logged in, you can start building custom workflows or learn how to build an n8n AI agent directly on your private server.

Which Option Should You Choose?

Choosing how to self-host n8n or use n8n Cloud comes down to your team’s technical expertise and maintenance capacity.

  • Choose n8n Cloud if: You want zero server management, instant setup, and guaranteed uptime without dealing with Linux, Docker, or database backups.
  • Choose Docker Self-Hosting if: You have basic Linux administration skills, want complete data privacy, need unlimited execution runs, and want to keep your monthly infrastructure bill low and predictable.
  1. 1

    Provision a VPS and Configure DNS

    Set up a Linux VPS (e.g. DigitalOcean, Hetzner, AWS) with at least 2 GB RAM. Create an 'A' DNS record pointing your domain or subdomain to your server's IP address.

  2. 2

    Install Docker and Docker Compose

    Connect to your VPS via SSH and install Docker along with Docker Compose using standard Linux package management commands.

  3. 3

    Configure docker-compose.yml

    Create a compose file defining your n8n container, environment variables (N8N_HOST, WEBHOOK_URL), and persistent volume mounts.

  4. 4

    Set Up Reverse Proxy and SSL

    Deploy Caddy or Nginx to proxy incoming traffic to n8n port 5678 and handle automatic SSL certificate issuance.

  5. 5

    Launch Container and Complete Setup

    Run docker compose up -d, open your web domain in a browser, and create your initial admin account.

Does this sound like your business?

Text me on WhatsApp