Skip to main content
Back to Builts AI Blog
How-To Guides

How to Self-Host n8n: Docker Setup Guide (2026)

Silviya Velani
Silviya VelaniFounder, Builts AI
|August 5, 2026|11 min read
How to Self-Host n8n: Docker Setup Guide (2026)

TL;DR

Self-hosting n8n takes about an hour: a $10-25/month VPS, Docker, one volume for persistence, and a reverse proxy for HTTPS. Use the official docker.n8n.io/n8nio/n8n image, keep SQLite until you pass a few thousand executions a month, then move to Postgres. Back up the .n8n directory (it holds your encryption key) before every update. Budget $85-175/month all-in once maintenance time counts — if that math doesn't work, n8n Cloud's Starter plan at €20/month is the honest alternative.

Self-hosting n8n is genuinely worth doing — and about to become the only way to run it yourself. n8n’s changelog confirms that v3.0, expected October 2026, drops support for npm installs entirely: self-hosted n8n will require Docker. Good news: the Docker path is also the easiest one, and you can have a production-ready instance running in about an hour on a $10-25/month server.

We run self-hosted n8n instances for client automations at Builts AI, and this guide is the setup we actually use: Docker, a persistent volume, Postgres when volume justifies it, HTTPS via a reverse proxy, and a boring, reliable update routine. If you’re still deciding whether to self-host at all, read our n8n review first — this guide assumes you’ve decided and want it done right.

What Do You Need Before Installing n8n?

Four things: a small VPS, Docker, a domain name, and 30-60 minutes. A server with 2 GB RAM and 1-2 vCPUs handles typical small-business automation loads — that’s $10-25/month at Hetzner or DigitalOcean, per their public pricing. The domain matters because n8n’s webhook triggers need a stable HTTPS address that services like Stripe or your CRM can call.

Checklist before you start:

  • VPS: Ubuntu 22.04 or newer, 2 GB RAM minimum. n8n’s own docs publish one-click guides for Hetzner and DigitalOcean.
  • Docker + Docker Compose: current versions from Docker’s official install script.
  • A subdomain: something like automation.yourdomain.com, with an A record pointing at the server.
  • A password manager entry ready for the encryption key you’re about to create. This file is the difference between a recoverable server and a rebuild.

Skip the temptation to run n8n on a machine that also does other jobs. Automation servers accumulate credentials to your CRM, calendar, and inbox — isolation is a security feature, not overkill.

How Do You Install n8n With Docker?

One volume and one docker run command gets n8n live on port 5678. This is the current official installation from n8n’s Docker docs (2026):

docker volume create n8n_data

docker run -it --rm \
 --name n8n \
 -p 5678:5678 \
 -e GENERIC_TIMEZONE="America/Toronto" \
 -e TZ="America/Toronto" \
 -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
 -e N8N_RUNNERS_ENABLED=true \
 -v n8n_data:/home/node/.n8n \
 docker.n8n.io/n8nio/n8n

Three details matter here. The image comes from n8n’s own registry (docker.n8n.io/n8nio/n8n), not Docker Hub mirrors. The volume mapping n8n_data:/home/node/.n8n is where n8n keeps its SQLite database and the credential encryption key — lose it and every stored login is gone. And the two timezone variables keep schedule-triggered workflows firing at your local time instead of UTC.

For production, convert this to a docker-compose.yml so the configuration lives in a file you can version-control. n8n maintains ready-made Compose files, including a Postgres variant, in its official hosting repository — start from those rather than hand-rolling one.

Should You Use SQLite or Postgres?

SQLite until it hurts, then Postgres. n8n defaults to SQLite inside the data volume with zero configuration, and for a handful of workflows running a few hundred executions a month it’s completely fine. We run early-stage client instances on SQLite deliberately — fewer moving parts to babysit.

SQLite (default)Postgres
SetupNoneSecond container + 6 env vars
Right forA few workflows, light volumeThousands of executions/month
ConcurrencySingle-writer, fine for small loadsHandles parallel workflows properly
BackupsCopy the volumepg_dump, point-in-time recovery

When you outgrow SQLite, n8n switches databases through environment variables — DB_TYPE=postgresdb plus the DB_POSTGRESDB_HOST, DB_POSTGRESDB_DATABASE, DB_POSTGRESDB_USER, DB_POSTGRESDB_PASSWORD, DB_POSTGRESDB_PORT, and DB_POSTGRESDB_SCHEMA connection settings, per n8n’s Docker documentation. Export your workflows first, or migrate the volume; the database swap doesn’t move data for you.

How Do You Put n8n Behind HTTPS?

Run a reverse proxy in front of port 5678 and give n8n its public URL through environment variables. Don’t expose 5678 to the internet raw: webhook endpoints carry real business data, and browsers block parts of n8n’s UI on plain HTTP anyway.

The simplest stack is Caddy — it provisions and renews Let’s Encrypt certificates automatically with a two-line config. Nginx plus certbot works just as well if that’s what you already run. Either way, tell n8n about its public address:

  • N8N_HOST=automation.yourdomain.com
  • WEBHOOK_URL=https://automation.yourdomain.com/

Without WEBHOOK_URL, n8n generates webhook addresses pointing at its internal port, and every external service you connect will call a URL that doesn’t resolve. This is the single most common self-hosting mistake we see in client audits — workflows that “worked in testing” because testing used the editor’s test URL, then silently never fire in production.

How Do You Back Up Self-Hosted n8n?

Back up the whole n8n_data volume, not just the database — the volume holds the credential encryption key. n8n’s docs are explicit that the .n8n directory “still contains other important data like encryption keys” even when your workflow data lives in Postgres. A backup that skips it restores your workflows with every credential locked.

A backup routine that has never lost us data:

  1. Nightly: snapshot the n8n_data volume (and pg_dump if you’re on Postgres) to storage that is not the same VPS.
  2. Before every update: manual snapshot, always. Thirty seconds of discipline beats an afternoon of forensics.
  3. Once: copy the encryption key into your password manager. If the server dies entirely, this key plus the database gets everything back.
  4. Quarterly: actually restore a backup to a scratch server. An untested backup is a hope, not a plan.

How Do You Update n8n Without Breaking Things?

Pin a version, back up, then pull and restart. With Compose the whole update is three commands, straight from n8n’s docs: docker compose pull, docker compose down, docker compose up -d. Using plain docker run, it’s docker pull docker.n8n.io/n8nio/n8n, stop, re-run.

Two rules keep updates boring. First, pin a specific version tag in your Compose file instead of latest, so upgrades happen when you schedule them — not whenever a container restarts. Second, read the release notes before any major-version jump. n8n ships breaking changes on majors; the v3.0 release expected October 2026 removes npm-based installs and is exactly the kind of change you want to meet on your own schedule.

What Does Self-Hosting n8n Actually Cost?

Around $85-175/month all-in, even though the software is free. The VPS is the small part — $10-25/month. The real line item is the 1-2 hours of monthly maintenance (updates, disk checks, the occasional broken node after an upgrade) that lands on whoever owns the server. At standard developer rates, that time dominates the budget. The full cost breakdown is in our n8n review, including when the math beats managed platforms like Make.

Cost itemMonthly
VPS (2 GB, Hetzner/DigitalOcean)$10-25
Domain + backup storage$2-10
Maintenance time (1-2 hrs at $75-100/hr)$75-150
Realistic total$85-175

The n8n software itself: $0, no execution limits, on a source-available license — the project reports nearly 200,000 GitHub stars on its site as of 2026, and the Community Edition is the same core engine the paid tiers run.

When Should You Use n8n Cloud Instead?

When nobody on your team wants to own a server — and that’s most small teams. n8n Cloud’s Starter plan runs €20/month for 2,500 executions, and Pro is €50/month for 10,000, per n8n’s pricing page as of August 2026. Compare that to the $85-175 realistic self-hosting total: unless maintenance hours are already paid for, the managed option is cheaper for light and moderate volume.

Self-hosting wins in three situations, and we hold clients to this list:

  • Data residency: healthcare under PHIPA, legal privilege, financial services — workflow data can’t touch a third-party cloud.
  • Volume: high execution counts where flat infrastructure cost beats per-execution tiers.
  • Control: custom nodes, private network access to internal systems, or code the managed platforms won’t run.

If none of those apply, take the managed option — our comparison of Zapier, Make, and n8n covers which platform fits which workload.

Key Takeaways

  • Docker is now the way: n8n v3.0 (expected October 2026) ends npm installs, per n8n’s changelog.
  • One volume, one command: the official docker.n8n.io/n8nio/n8n image with n8n_data mounted at /home/node/.n8n gets you live on port 5678.
  • SQLite first, Postgres when volume demands it — the switch is six environment variables.
  • Set WEBHOOK_URL behind your HTTPS proxy or external triggers will silently fail.
  • Back up the volume, not just the database: the encryption key lives there.
  • Budget $85-175/month honestly; at low volume, n8n Cloud’s €20 Starter beats self-hosting on cost.

And if you’d rather have the outcome without owning the server: building and running n8n automations for small businesses is exactly what we do — see how we build custom workflows.

Want this done for you?

This guide works — if you have the time. We build this exact kind of system for small businesses in 2–3 weeks.

Book a Free Audit

Frequently asked questions

How long does it take to self-host n8n?

About an hour for a working instance: 15 minutes to provision a VPS, 10 to install Docker, 5 to start the n8n container, and the rest for HTTPS and a domain. Production hardening — Postgres, backups, monitoring, update routine — adds 2-4 hours. Plan a morning, not a weekend.

What server do I need to self-host n8n?

A small VPS with 2 GB of RAM and 1-2 vCPUs runs n8n comfortably for typical small-business workloads. That's $10-25/month at providers like Hetzner or DigitalOcean. Add RAM before CPU if workflows process large payloads. You'll also want a domain name so webhooks get a stable HTTPS address.

Is self-hosted n8n actually free?

The software is free — n8n's Community Edition is source-available and has no execution limits. The running costs aren't: a VPS is $10-25/month and maintenance takes 1-2 hours monthly. At standard developer rates, the realistic all-in cost is $85-175/month. Free software, paid responsibility.

Should I run n8n on SQLite or Postgres?

Start with SQLite — it's the default, needs zero setup, and handles light workloads fine. Move to Postgres when you pass a few thousand executions a month, run multiple concurrent workflows, or need reliable point-in-time backups. n8n switches with six DB_POSTGRESDB environment variables; your workflows carry over via export or a volume migration.

Can I still install n8n with npm?

Not for long. n8n's changelog announces that with v3.0, expected October 2026, self-hosted n8n requires a Docker-based deployment and npm/npx installs stop being supported. If you're running an npm install today, plan the migration to Docker now rather than during the forced upgrade.

How do I update self-hosted n8n safely?

Back up first, then pull and restart: docker compose pull, docker compose down, docker compose up -d. Pin a specific version tag instead of latest so updates happen when you choose. Read the release notes before major-version jumps — n8n ships breaking changes on majors, and a broken automation server takes your workflows down with it.

What happens if I lose my n8n encryption key?

You lose every stored credential. n8n encrypts credentials with a key kept in the .n8n directory, so a database backup without that key restores workflows but not logins to your apps. Back up the full n8n_data volume, not just the database, and store a copy of the key somewhere safe.

When is n8n Cloud better than self-hosting?

When nobody on your team wants to own a server. n8n Cloud's Starter plan is €20/month for 2,500 executions — less than realistic self-hosting costs once maintenance time counts. Self-host when data residency rules apply, execution volume is high, or you need custom nodes and full environment control.

Rather Have Someone Build This?

Free 30-minute call. We'll map the workflow and send a written plan in 48 hours.