Find your tool
☰
Pricing
Best tools
Alternatives
Guides
How we testAboutFind your tool

Home › Guides › How to Self-Host n8n with Docker

Last updated: October 29, 2026

TechCurato is reader-supported. Some links are affiliate links: we may earn a commission at no extra cost to you. Learn more.

How to Self-Host n8n with Docker: A Step-by-Step Tutorial

To self-host n8n, rent a small Linux VPS, install Docker, run the official n8n container with a persistent volume, then put it behind HTTPS with a domain and a reverse proxy. The n8n Community edition is free; you only pay for the server, which pricing guides put at about $5 to $20 a month for a basic VPS. This guide walks through each step, plus the backups and updates most tutorials skip.

Why trust this pagePrices checked on October 29, 2026 on official pricing pages · Links to official sources · Downsides listed for every tool, partners included · Rankings are never paid.
Key facts
  • Licence: n8n Community edition, free to self-host.
  • Typical cost: a small VPS, about $5–20/month according to hosting guides.
  • Requirements: Linux server, Docker, a domain name, HTTPS.
  • Time: about 1 hour for a first install.
  • Ongoing work: updates and backups, about 1 hour a month.
n8n interface, image from n8n.io
Image: n8n

Before you start: is self-hosting right for you?

Self-hosting n8n makes sense if:

  • You are comfortable with a Linux terminal and Docker.
  • You expect more workflow runs than n8n Cloud Starter's 2,500 a month, or want unlimited executions.
  • You need your data to stay on your own infrastructure.
  • You already run a VPS for other projects.

It does not make sense if nobody on your team can maintain a server. In that case, n8n Cloud at €20 a month (annual billing) is simpler.

Self-hostedn8n Cloud Starter
LicenceFree€20/month (annual)
ExecutionsLimited by your server2,500/month
Updates and backupsYoun8n
Data locationYour servern8n's cloud

Step 1: choose a server

A small VPS is enough for most small businesses running a few dozen workflows. Practical guidance from n8n hosting guides:

  • Start with 2 vCPU and 2–4 GB of RAM if you run moderate workflows.
  • Add RAM if your workflows process large files or many items at once.
  • Pick a region close to your apps to keep API calls fast.

If you already have a VPS running other apps, you can run n8n in its own Docker container beside them, as long as the server has spare memory.

Step 2: install Docker

On a fresh Ubuntu server, install Docker using Docker's official installation instructions for your distribution, then confirm it works:

docker --version
docker run hello-world

Add your user to the docker group so you don't need sudo for every command.

Step 3: run n8n with a persistent volume

The volume keeps your workflows and credentials when the container restarts or updates. A minimal run command, following the pattern in n8n's documentation:

docker volume create n8n_data
docker run -d --name n8n --restart unless-stopped \
  -p 5678:5678 \
  -v n8n_data:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n

n8n now listens on port 5678. Do not expose it publicly like this for long: the next step adds HTTPS.

Step 4: add a domain and HTTPS

Webhooks from other apps need a stable HTTPS address, such as https://n8n.yourdomain.com.

  1. Point a subdomain to your server with an A record at your DNS provider.
  2. Install a reverse proxy such as Caddy, Traefik or Nginx. Caddy and Traefik obtain free TLS certificates automatically.
  3. Forward the subdomain to port 5678 on the n8n container.
  4. Tell n8n its public address with environment variables so webhook URLs are correct: set the host, protocol and webhook URL (see n8n's environment variable documentation for the exact names).

Once HTTPS works, close direct public access to port 5678 in your firewall.

Step 5: secure your instance

  • Set an encryption key and store it safely. n8n uses it to encrypt credentials; losing it means re-entering every API key.
  • Create the owner account on first login with a strong password.
  • Limit access: only invite people who need to build workflows.
  • Keep the server updated: apply OS security updates monthly.
  • Isolate n8n: its own container, its own volume, no shared secrets with other apps.

Step 6: back up everything

Most self-hosting problems are backup problems. Back up daily:

  1. The n8n data volume (n8n_data), which holds workflows and credentials.
  2. The encryption key, stored outside the server.
  3. Your environment configuration (the run command or compose file).

Then test a restore on a second machine once. A backup you have never restored is a hope, not a backup.

Step 7: update n8n safely

New versions bring features and security fixes. To update:

docker pull docker.n8n.io/n8nio/n8n
docker stop n8n && docker rm n8n
# run the same docker run command as in Step 3

Because data lives in the volume, your workflows survive the update. Take a backup first, read the release notes for breaking changes, and update monthly rather than skipping many versions.

Step 8: monitor your instance

  • Uptime check: a free uptime monitor pinging your n8n URL every few minutes.
  • Error workflow: an n8n workflow that sends you an alert when another workflow fails.
  • Disk space: execution logs grow; configure n8n to prune old execution data.

What it really costs

ItemMonthly cost
VPSabout $5–20 (hosting guides)
Domainabout $1 (a yearly domain spread over 12 months)
TLS certificate$0 with Caddy or Traefik
n8n licence$0 (Community edition)
Your timeabout 1 hour/month for updates and checks

Compared with n8n Cloud Starter at €20 a month (€720 over 3 years), self-hosting can cost less, but only if you count your time honestly.

Troubleshooting common problems

ProblemLikely causeFix
Webhooks show localhost URLsPublic URL not configuredSet n8n's webhook URL environment variable to your HTTPS domain
Workflows lost after restartNo persistent volumeMount a volume at /home/node/.n8n
Credentials no longer decryptEncryption key changedRestore the original key
Server runs out of memoryLarge workflows or too little RAMAdd RAM or process data in smaller batches
Disk fills upExecution history kept foreverEnable pruning of old executions

Self-hosting vs n8n Cloud: final decision

Self-host if you have the skills, a server and a reason (volume, cost or data control). Choose n8n Cloud if you want to build automations, not maintain infrastructure. You can start on Cloud and move to self-hosting later by exporting your workflows.

Prefer no maintenance? Try n8n Cloud → No credit card on Starter and Pro trials

Docker Compose or a single container?

A single docker run command is the fastest way to start. As soon as you add a reverse proxy or a separate database, a Docker Compose file is easier to maintain: all services, volumes and environment variables live in one file you can back up and version. Many self-hosters move to Compose after the first week.

Should you use PostgreSQL?

By default, n8n stores its data in a SQLite file inside the volume, which is fine for small setups. For heavier use or several users, n8n supports PostgreSQL as its database. Check n8n's documentation for the database environment variables before switching, and migrate only with a fresh backup.

Our verdict

Self-hosting n8n is one of the best-value moves in automation, provided someone owns the server. If you can spend an hour a month on updates and checking backups, you get unlimited executions for the price of a small VPS and keep your data on your own infrastructure. If nobody can own that job, n8n Cloud is the safer choice: you lose nothing in features for typical small-business workflows, and you can always move to self-hosting later by exporting your workflows.

FAQ

Is self-hosted n8n really free?

Yes, the Community edition licence is free. You pay for the server and spend time on maintenance.

How much RAM does n8n need?

A small VPS with 2–4 GB of RAM handles moderate workflows; add more for large files or heavy data.

Can I self-host n8n on the same VPS as other apps?

Yes, in its own Docker container, if the server has enough spare memory and you keep the apps isolated.

How do I update self-hosted n8n?

Back up, pull the latest image, remove the old container and start a new one with the same volume.

What happens if I lose the encryption key?

Stored credentials can no longer be decrypted, so you would need to re-enter them. Keep the key backed up outside the server.

Sources

n8n.io/pricing and n8n's official documentation at docs.n8n.io, checked October 29, 2026. VPS price range from 2026 n8n hosting guides. Verify commands and environment variable names against the current documentation before running them.

Our pickPrefer no maintenance? Try n8n Cloud →