How to Self-Host n8n with Docker
Steps checked against n8n’s documentation on 26 November 2026.
In short: n8n is a workflow automation tool with AI agent and MCP nodes. Its free
self-hosted version, the Community Edition, runs on your own computer or server through Docker. n8n's
own setup is one command, curl -fsSL https://get.n8n.io | sh, which installs n8n and opens it at
http://localhost:5678. Below: what you need, every step on Windows, Mac and Linux, the everyday
commands, and what n8n lists for running it on the internet.
Self-hosted or n8n Cloud?
| Self-hosted Community Edition | n8n Cloud (hosted by n8n) | |
|---|---|---|
| Price | Free software; you pay for the computer or server it runs on | Starter $20 and Pro $50 a month, billed annually (n8n's prices in USD) |
| Executions included | Not listed on the pricing page | 2,500 a month on Starter, 10,000 on Pro |
| Setup and upkeep | You install, update, back up and secure it | Run by n8n |
| Bash scripts, custom nodes | Available | Listed as self-hosted only |
| License | n8n's Sustainable Use License | n8n's terms |
Plans from n8n's pricing page, read 26 November 2026. n8n's Sustainable Use License lets you use and modify n8n for your own internal business purposes or for non-commercial or personal use; offering it to others needs a separate agreement with n8n. n8n's docs also state that it recommends self-hosting for expert users, because mistakes "can lead to data loss, security issues, and downtime", and recommends n8n Cloud to people who are not experienced at managing servers.
What you need
| Windows | Mac | Linux (or a server) | |
|---|---|---|---|
| Docker | Docker Desktop with the WSL 2 engine | Docker Desktop | Docker Engine with the Docker Compose v2 plugin, or Docker Desktop |
| Terminal | WSL (Ubuntu); PowerShell and Command Prompt cannot run the setup script | Terminal | Any shell |
| Memory | At least 4 GB of RAM and 2 vCPUs for the full setup, which includes the sandbox for n8n Assistant | Same | Same |
From n8n's one-line setup and
Docker Compose
pages. From n8n 3.0, n8n is only distributed through Docker; the old npm install n8n / npx n8n
route no longer works for new installs.
Self-host n8n on Windows
Step 1: Install WSL. Press the Start key, type PowerShell, right-click Windows PowerShell and choose Run as administrator. Type this line and press Enter, then restart the computer when it finishes:
wsl --install
It installs Ubuntu, a Linux system that runs inside Windows. It needs Windows 10 version 2004 or newer, or Windows 11 (Microsoft's guide).
Step 2: Set up Ubuntu. After the restart, open Ubuntu from the Start menu. The first launch unpacks files, then asks you to choose a user name and password for Ubuntu. Type them and press Enter after each (the password does not show as you type).
Step 3: Install Docker Desktop. Download it from docker.com and run the installer. If it asks to turn on WSL 2, accept. Then start Docker Desktop from the Start menu and leave it running.
Step 4: Turn on Docker for Ubuntu. In Docker Desktop, open Settings, then Resources, then WSL Integration, check that Ubuntu is switched on, and click Apply (Docker's guide).
Step 5: Run n8n's setup command. Go back to the Ubuntu window. Paste this line (right-click pastes) and press Enter:
curl -fsSL https://get.n8n.io | sh
It checks that Docker is running, creates a folder called n8n in your Ubuntu home folder, writes the
settings files, downloads n8n and starts it. The first run can take a few minutes. n8n's docs say to
keep the project inside the Ubuntu file system (your home folder, ~), not under /mnt/c/.
Step 6: Open n8n. When the window prints n8n is running at: http://localhost:5678, open that
address in your browser. If the page does not load straight away, wait a moment and refresh.
Self-host n8n on Mac
Step 1: Install Docker Desktop. Download it from docker.com, open the downloaded file, drag Docker to Applications, then open Docker from Applications and leave it running.
Step 2: Open Terminal. Press Command + Space, type Terminal, and press Enter.
Step 3: Run n8n's setup command. Paste this line with Command + V and press Enter:
curl -fsSL https://get.n8n.io | sh
Step 4: Open n8n. When Terminal prints n8n is running at: http://localhost:5678, open that
address in your browser.
Self-host n8n on Linux or a server
Step 1: Install Docker. Install Docker Engine and the Docker Compose v2 plugin (Docker's guide). Check both with:
docker compose version
Step 2: Run n8n's setup command in the folder where n8n should live:
curl -fsSL https://get.n8n.io | sh
Step 3: Open n8n at http://localhost:5678 on that machine.
To read the script before running it, n8n gives this alternative:
curl -fsSL https://get.n8n.io -o get-n8n.sh
less get-n8n.sh
sh get-n8n.sh

What the setup installs
| Part | What it does |
|---|---|
| n8n | The workflow editor, at http://localhost:5678 |
| SQLite database | Stores workflows, credentials and run history in a file; nothing separate to install |
| Sandbox and search services | Let n8n Assistant run the code it writes and search the web; the assistant stays off until you add an AI provider key |
Your data is kept in the n8n folder and a Docker volume called n8n-data. n8n's docs warn that the
bundled sandbox is for development and testing: its runner is privileged, so code that escapes it
reaches the host. They advise running this setup on a dedicated machine or virtual machine and never
exposing it to the internet.
Turn on the AI assistant
n8n works without n8n Assistant. To turn it on, add your AI provider's API key in the instance's AI
settings in n8n, or put it on the N8N_INSTANCE_AI_MODEL_API_KEY line of n8n/.env and restart:
docker compose -f ./n8n/compose.yml up -d
Free API keys from several providers are listed in free AI API keys.
Everyday commands
Run these from the folder that contains the n8n folder.
| To do this | Run this |
|---|---|
| Stop n8n | docker compose -f ./n8n/compose.yml down |
| Start it again | docker compose -f ./n8n/compose.yml up -d |
| Update to the latest version | curl -fsSL https://get.n8n.io | sh -s -- --upgrade |
| Remove n8n and delete all its data | docker compose -f ./n8n/compose.yml down -v, then rm -rf ./n8n |
The update command changes only the version lines in .env; workflows, secrets and settings stay as
they are.
Running n8n on the internet
n8n's production requirements list, among other things:
- A 64-bit Linux host.
- PostgreSQL instead of the built-in SQLite for production; n8n doesn't recommend SQLite for
multi-user production use. The Docker Compose guide
has the steps to add a
postgresservice. - A reverse proxy or load balancer in front of n8n, with a TLS certificate for your hostname. n8n's docs say not to expose the n8n process directly to the internet.
- A DNS record for a hostname such as
n8n.example.com, set inN8N_HOST,N8N_EDITOR_BASE_URLandN8N_WEBHOOK_URL, so webhooks from outside services reach it. - Port 5678 reachable only from the proxy; PostgreSQL (5432) and the task broker (5679) kept private.
Related
- Make vs n8n vs Zapier: plan prices and what each one bills by.
- MCP servers for coding agents: n8n can act as an MCP client and server.
- How to run an LLM locally: models n8n's AI nodes can call on your own computer.
Frequently asked questions
Is self-hosted n8n free?+
Yes. The Community Edition is free to download and run under n8n’s Sustainable Use License, which allows use for your own internal business purposes or for non-commercial or personal use. You pay for the computer or server it runs on.
What are the requirements to self-host n8n?+
Docker with the Docker Compose v2 plugin. n8n’s Docker Compose guide asks for at least 4 GB of RAM and 2 vCPUs for the full setup, which includes the sandbox for n8n Assistant. For production n8n recommends a 64-bit Linux host and PostgreSQL.
Can I self-host n8n on Windows?+
Yes, through WSL. Install WSL and Docker Desktop with its WSL 2 engine, then run n8n’s setup command in the Ubuntu terminal. n8n’s docs state that PowerShell and Command Prompt cannot run the setup script.
Can I still install n8n with npm?+
Not for new installs from n8n 3.0. n8n’s docs state that from 3.0 it is only distributed through Docker; existing npm installs keep working for now.
What is the difference between self-hosted n8n and n8n Cloud?+
n8n Cloud is run by n8n and billed by workflow executions: Starter is $20 a month for 2,500 executions and Pro $50 for 10,000, billed annually. Self-hosted n8n is free software you install, update, back up and secure yourself; bash scripts and custom nodes are listed as self-hosted only.
Is it safe to put my self-hosted n8n on the internet?+
Not with the one-line setup as it is: n8n’s docs say its bundled sandbox is for development and testing and should never be exposed to the internet. For production n8n lists a reverse proxy with a TLS certificate in front of n8n, PostgreSQL and a DNS hostname, and says not to expose the n8n process directly.