DEV Community

Cover image for Self-Host n8n with Docker in 10 Minutes (The Simple Way)
Andrei P.
Andrei P.

Posted on

Self-Host n8n with Docker in 10 Minutes (The Simple Way)

Self-Host n8n with Docker (Simple, Cross-Platform) + npm Alternative

Image

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Then open your browser:

http://localhost:5678
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

πŸš€ Alternative: Install n8n with npm (No Docker)

If you prefer running n8n directly on your OS without containers, use npm:

  1. Install Node.js 20.19–24.x (official requirement). (n8n Docs)

  2. Global install:

   npm install -g n8n
Enter fullscreen mode Exit fullscreen mode
  1. Start:
   n8n
   # or
   n8n start
Enter fullscreen mode Exit fullscreen mode
  1. Open:
   http://localhost:5678
Enter fullscreen mode Exit fullscreen mode

Or try without installing:

npx n8n
Enter fullscreen mode Exit fullscreen mode

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)