Self-Host n8n with Docker (Simple, Cross-Platform) + npm Alternative
n8n is a low-code workflow automation platform you can fully self-host on Windows, macOS, or Linux without SaaS limitations and with full data control. (n8n Docs)
πΉ Step 1 β Install Docker on Your OS
n8n containers run on Docker Desktop for Windows & macOS or on Docker Engine on Linux. (n8n Docs)
Windows & macOS:
Download Docker Desktop for your system from the official Docker site and install it like any app (supports both AMD64 and Apple Silicon Macs).
Linux:
Install Docker Engine (and optionally Docker Compose) with your package manager (e.g., apt, dnf, pacman), then verify:
docker --version
If this prints a version number, Docker is ready.
πΉ Step 2 β Run n8n with One Command
The absolute simplest way to start n8n:
docker run -p 5678:5678 n8nio/n8n
Then open your browser:
http://localhost:5678
You now have n8n running locally.
πΉ Step 3 β Save and Keep Your Workflows
The above command loses all your data when the container stops.
Use this improved one instead:
docker run -d \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/home/node/.n8n \
n8nio/n8n
Explanation:
-
-dβ Runs in background -
--name n8nβ Easier to manage -
-v ~/.n8n:/home/node/.n8nβ Saves workflows to your home directory
You can stop and restart easily:
docker stop n8n
docker start n8n
π Alternative: Install n8n with npm (No Docker)
If you prefer running n8n directly on your OS without containers, use npm:
Install Node.js 20.19β24.x (official requirement). (n8n Docs)
Global install:
npm install -g n8n
- Start:
n8n
# or
n8n start
- Open:
http://localhost:5678
Or try without installing:
npx n8n
Thatβs the quickest way to test n8n locally. (n8n Docs)
π When You Want Professional Hosting
The simple commands above are great for local testing and small home projects, but if you need a production-ready setup with HTTPS, domain hosting, real databases, backups, scaling, and secure credentials, follow the official n8n hosting guides:
π https://docs.n8n.io/hosting/ β production deployment step-by-step. (n8n Docs)
This official documentation covers:
- Persistent storage + PostgreSQL
- Reverse proxies and SSL
- High-availability configurations
- Environment and security best practices
π― What You Now Have
- A self-hosted automation platform
- Works on Windows, macOS, or Linux
- Unlimited workflows
- Full data ownership
- Two install options: Docker or npm
Everything you need to automate APIs, webhooks, forms, email flows, and even AI workflows β without SaaS limits. (n8n Docs)

Top comments (0)