The quickest way to install n8n with Docker is n8n’s own one-line setup: one command downloads n8n, starts it and prints the address to open. It runs free on your own computer.
This guide installs n8n’s free, self-hosted Community Edition. By the end, n8n is running at http://localhost:5678 with your own owner account, and you know the commands to stop it, start it again and remove it. It’s the install guide for the n8n Tutorial: Part 1 explains what n8n is, and Part 2 builds your first workflow on this install.
This is the install guide for the n8n Tutorial. Every part of the series:
All parts of the n8n Tutorial
Module A: Start Here
Module B: Workflow Basics
- Part 3: Run a Workflow on a Schedule
- Part 4: Webhooks: Start a Workflow from Any App
- Part 5: Forms: Collect Data with n8n Forms
- Part 6: Credentials: Connect n8n to Your Apps
- Part 7: Executions, Debugging and Pinned Data
- Part 8: Organise Your Workflows
Module C: Working with Data
- Part 9: Items and JSON: How Data Moves in n8n
- Part 10: Expressions: Use Data from Earlier Nodes
- Part 11: Transform Data
- Part 12: Filter and Compare Data
- Part 13: Dates and Times
- Part 14: Files: CSV, Excel and PDF
- Part 15: Data Tables: Store Data Inside n8n
Module D: Flow Logic
- Part 16: If and Switch: Make Decisions
- Part 17: Merge: Combine Branches
- Part 18: Loops and Batches
- Part 19: Wait and Human Approval
- Part 20: Sub-workflows
- Part 21: Error Handling
Module E: Code and APIs
- Part 22: HTTP Request: Call Any API
- Part 23: The Code Node in JavaScript
- Part 24: The Code Node in Python
Module F: AI with Claude
- Part 25: Your First AI Agent
- Part 26: Give Your Agent Tools
- Part 27: Memory That Lasts
- Part 28: Answer from Your Documents
- Part 29: AI Chains: Summarize, Classify and Extract
- Part 30: Human in the Loop and Guardrails
- Part 31: MCP in n8n
- Part 32: Evaluations: Test Your AI Workflows
- Part 33: Free Local AI with the Self-Hosted AI Starter Kit
- Part 34: An n8n Agent in Microsoft Teams
Module G: Connect Apps and Extend n8n
- Part 35: Connect Popular Apps with OAuth2
- Part 36: Community Nodes
- Part 37: Build Your Own Node
- Part 38: Programmatic Nodes and Publishing
- Part 39: The n8n API and CLI
- Part 40: Build Workflows in Code with the Workflow SDK
Module H: Self-Hosting for Production
- Part 41: Configure n8n with Environment Variables
- Part 42: Run n8n on PostgreSQL
- Part 43: Queue Mode and Workers
- Part 44: Task Runners and Security
- Part 45: Back Up, Restore and Update n8n
- Part 46: Logs, Metrics and Tracing
- Part 47: Put n8n Online with HTTPS
Module I: Users and Administration
- Part 48: Users, Roles and Two-Factor Authentication
Module J: n8n Cloud
- Part 49: Start an n8n Cloud Free Trial
- Part 50: AI Workflow Builder, Assistant and Gateway Credits
Module K: Wrap-up
- Part 51: Final Project, Cheat Sheet and What to Learn Next
Cost: free. n8n’s Community Edition costs nothing to self-host. Docker Desktop (opens in a new tab) is free for personal use, education and small businesses (fewer than 250 employees and less than $10 million in yearly revenue); larger companies need a paid Docker subscription.
Every command, screen and output on this page is real, run with n8n 2 in Docker Desktop on macOS.
Prerequisites
- Docker Desktop installed and running. Docker’s guide Install Docker Desktop on Mac (opens in a new tab) covers the install.
Step 1: Open Terminal
Press ⌘ Space, type Terminal and press Return. Terminal opens in your home folder. The setup creates a folder named n8n there to hold n8n’s settings, so remember where you ran it: the stop and start commands later run from the same place.
Step 2: Run n8n’s One-Line Setup
Paste this command into Terminal and press Return. It downloads n8n’s setup script from n8n’s website and runs it. The script checks that Docker is running, writes n8n’s settings, downloads n8n and starts it.
curl -fsSL https://get.n8n.io | sh
Prefer to read a script before you run it? n8n’s docs show how (opens in a new tab) to download it first.
The first run downloads several parts of n8n, so it takes a few minutes; here it took about two and a half. Wait for the line that starts with All set!:
✔ Docker found (29.9.3)
✔ Docker Compose found (5.7.0)
✔ Created ./n8n/compose.yml
✔ Created ./n8n/searxng-settings.yml
✔ Created ./n8n/.env (unique secrets generated)
Pulling images (this can take a few minutes on first run)...
[+] pull 62/62
✔ Image ghcr.io/n8n-io/runners:2.48.5 Pulled 59.9s
✔ Image ghcr.io/n8n-io/n8n-sandbox-service-runner-dind:1.8.1 Pulled 32.1s
✔ Image ghcr.io/n8n-io/n8n-sandbox-service-api:1.8.1 Pulled 46.4s
✔ Image docker.io/n8nio/n8n:2.48.5 Pulled 134.9s
✔ Image ghcr.io/searxng/searxng:latest Pulled 48.2s
✔ Started n8n 2.48.5 and sandbox services
Waiting for n8n to become ready (first boot pulls images and runs migrations) ... ✓
n8n is running at: http://localhost:5678
Data stored in: ./n8n (Docker volume: n8n-data)
Config files: ./n8n/compose.yml, ./n8n/.env
To stop: docker compose -f ./n8n/compose.yml down
To start: docker compose -f ./n8n/compose.yml up -d
More everyday commands: https://docs.n8n.io/deploy/host-n8n/install-options/one-line-setup#everyday-commands
Security notes:
- Only port 5678 (n8n) should ever be reachable from the internet.
- The sandbox runner is privileged Docker-in-Docker — never publish its ports.
This setup is meant to try n8n locally. For production (TLS, Postgres, queue
mode) see https://docs.n8n.io/hosting/
get-n8n.sh v1.4.0 — source: https://github.com/n8n-io/n8n/blob/master/docker/get-n8n.sh
➜ All set! Open http://localhost:5678 in your browser to get started.
The setup made two things:
- The
n8nfolder, with n8n’s settings:compose.ymllists the containers to run, and.envholds the n8n version and secret keys the setup generated. Keep.envprivate. - A Docker volume,
n8n-data, which stores your workflows, credentials and run history. Your data lives here, not in the folder.
The setup installs the newest stable release of n8n and records its version in .env, so n8n never changes version on its own.
Security note: the setup also starts helper containers for n8n Assistant, an optional AI helper that stays off until you add a key from an AI provider. One of them, the sandbox runner, has full (privileged) access to Docker. n8n’s docs (opens in a new tab) say to run this setup on a dedicated machine or virtual machine with nothing else on it, and never to expose it to the internet. Use it to learn and try n8n; a later part of this series covers a production setup.
Step 3: Create Your Owner Account
Open http://localhost:5678 in your browser. n8n asks you to set up the owner account: the admin of this n8n. It’s stored in your own n8n, on your computer.
- Type your Email, First Name and Last Name.
- Choose a Password with at least 8 characters, a number and a capital letter.
- Tick I want to receive security and product updates only if you’d like n8n’s emails, then click Next.

Step 4: Answer or Skip the Questions
n8n asks five questions about you and your company to tailor the app. Every answer is optional. Answer them or leave them blank, then click Get started.

Step 5: Get the Free License Key, or Skip It
n8n offers a free license key that unlocks three extra features for good: advanced debugging, execution search and tagging, and folders. To get it now, type your email and click Send me a free license key. To get it later, click Skip; How to Get a Free n8n Community Edition License Key shows the steps from Settings.

Step 6: Open Overview
n8n now shows a page about n8n Assistant, its built-in AI helper. It’s optional and needs a key from an AI provider, so leave it for now: click Overview in the menu on the left (the house icon when the menu is collapsed).

Overview shows Let’s build your first automation. n8n is installed and ready.

Advertisement
Stop and Start n8n
n8n keeps running until you stop it. Run these commands in Terminal from the folder where you ran the setup (your home folder, if you followed Step 1).
To stop n8n, run this. It stops and removes n8n’s containers; your workflows stay safe in the n8n-data volume.
docker compose -f ./n8n/compose.yml down
[+] down 7/7
✔ Container n8n-runners-1 Removed 3.5s
✔ Container n8n-searxng-1 Removed 0.8s
✔ Container n8n-sandbox-runner-1-1 Removed 1.4s
✔ Container n8n-n8n-1 Removed 1.3s
✔ Container n8n-sandbox-api-1 Removed 0.2s
✔ Container n8n-sandbox-certs-1 Removed 0.0s
✔ Network n8n_default Removed 0.1s
To start it again, run this. up creates the containers again, and -d runs them in the background so you get your Terminal back.
docker compose -f ./n8n/compose.yml up -d
[+] up 7/7
✔ Network n8n_default Created 0.0s
✔ Container n8n-searxng-1 Started 1.2s
✔ Container n8n-sandbox-certs-1 Exited 1.1s
✔ Container n8n-sandbox-api-1 Healthy 6.9s
✔ Container n8n-sandbox-runner-1-1 Started 7.1s
✔ Container n8n-n8n-1 Started 7.0s
✔ Container n8n-runners-1 Started 7.2s
n8n needs a few seconds after the command finishes before its pages load. Your owner account and workflows are still there.
Note: n8n doesn’t start on its own when you restart your computer. Open Docker Desktop, then run the start command.
Clean Up: Remove n8n
Keep n8n installed for the rest of the series. If you ever want to remove it completely, run these two commands from the same folder.
Warning: this deletes every workflow, credential and run history in this n8n, and there’s no undo.
The first command stops n8n, and -v also deletes its volumes, where your data lives:
docker compose -f ./n8n/compose.yml down -v
[+] down 9/9
✔ Container n8n-sandbox-runner-1-1 Removed 1.4s
✔ Container n8n-searxng-1 Removed 0.8s
✔ Container n8n-runners-1 Removed 3.2s
✔ Container n8n-n8n-1 Removed 0.6s
✔ Container n8n-sandbox-api-1 Removed 0.2s
✔ Container n8n-sandbox-certs-1 Removed 0.0s
✔ Volume n8n_sandbox-tls Removed 0.0s
✔ Volume n8n_n8n-data Removed 0.0s
✔ Network n8n_default Removed 0.1s
The second deletes the n8n folder and its settings. It prints nothing.
rm -rf ./n8n
Docker keeps the parts it downloaded, about 2.5 GB here. To free that space, delete the n8n, runners, sandbox and searxng images from the Images list in Docker Desktop.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Running the setup before Docker Desktop has started | The setup stops with The Docker daemon is not running | Open Docker Desktop, wait until it’s running, then run the setup again |
| Running the stop or start command from another folder | compose file "…/n8n/compose.yml" is invalid: open …: no such file or directory | Go back to the folder that holds the n8n folder |
Adding -v when you only want to stop n8n | All your workflows and credentials are deleted | Stop with down alone |
| Running the setup again to restart n8n | It prints Found an existing install in ./n8n — leaving it untouched. | Use the start command |
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
Error: The Docker daemon is not running | Docker Desktop isn’t running | Open Docker Desktop and run the setup again |
something is already listening on port 5678 | Another program, often another n8n, already uses n8n’s port | Stop that program, then run the setup again |
Docker Hub pull rate limit reached | Too many anonymous downloads from Docker Hub | The setup’s own advice: wait about an hour, or sign in with docker login, then start n8n |
The page shows Cannot GET right after starting | n8n is still starting up | Wait a few seconds and reload the page |
FAQ
Is n8n free to install?
Yes. The self-hosted Community Edition is free, and this setup installs it. Is n8n Free for Commercial Use? explains what n8n’s licence allows.
Which version of n8n does it install?
The newest stable release on the day you run it. The setup writes that version into .env as N8N_VERSION, so n8n stays on it until you update.
Where are my workflows stored?
In the Docker volume n8n-data, in n8n’s built-in SQLite database. The n8n folder only holds settings, which is why stopping and starting never loses work.
Can I use this setup on a server?
n8n says this setup is meant to try n8n locally, and points to its production requirements (opens in a new tab) for a server: HTTPS, PostgreSQL and more. A later module of this series covers that.
Do I need the free license key?
No. n8n works fully without it. The key only adds folders, advanced debugging, and execution search and tagging.
Conclusion
One command installed n8n with Docker: it’s running at http://localhost:5678 with your owner account, your data sits in a Docker volume, and two short commands stop and start it. That’s everything the rest of the n8n Tutorial needs.
Next: Part 2: Build Your First n8n Workflow →
Additional Resources
- One-line setup (opens in a new tab) (n8n docs)
- Install using Docker Compose (opens in a new tab) (n8n docs)
- Compare editions (opens in a new tab) (n8n docs)
- The setup script’s source (opens in a new tab) (n8n on GitHub)
- Install Docker Desktop on Mac (opens in a new tab) (Docker docs)
Related
- n8n Tutorial — Part 1: What Is n8n? Workflow Automation Explained
- n8n Cloud vs Self-Hosted: Which Should You Use?
n8n, Docker and other names mentioned are trademarks of their respective owners. JD Bots isn’t affiliated with or endorsed by n8n GmbH or Docker, Inc.
0 comments