Skip to main content
0 reactions

How to Install n8n with Docker

Card titled How to Install n8n with Docker, labelled n8n Tutorial install guide, with a terminal window showing four ticked steps: Docker is running, run one-line setup, n8n 2 starts up, open localhost:5678.

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

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.

TerminalBash
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!:

OutputPlain text
✔ 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 n8n folder, with n8n’s settings: compose.yml lists the containers to run, and .env holds the n8n version and secret keys the setup generated. Keep .env private.
  • 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.

  1. Type your Email, First Name and Last Name.
  2. Choose a Password with at least 8 characters, a number and a capital letter.
  3. Tick I want to receive security and product updates only if you’d like n8n’s emails, then click Next.
The n8n Set up owner account form filled in with the email user@example.com, the name Demo User and a hidden password, with a Next button below.
Create the owner account: the admin of your n8n.

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.

The Customize n8n to you dialog with five optional questions about your company, your role, who your automations are for, company size and how you heard about n8n, and a Get started button.
Every question is optional: 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.

The Get paid features for free (forever) dialog listing advanced debugging, execution search and tagging, and folders, with an email box, a Skip link and a Send me a free license key button.
The free license key offer: get it now or click Skip.

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).

The n8n Assistant page with the heading Build and debug faster with the n8n Assistant, three things it can do, a Connect a model button and a link to turn it off.
n8n Assistant is optional and needs an AI key: leave it for now.

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

The n8n Overview page showing Let’s build your first automation with two cards, Build an agent and Build a workflow.
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.

TerminalBash
docker compose -f ./n8n/compose.yml down
OutputPlain text
[+] 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.

TerminalBash
docker compose -f ./n8n/compose.yml up -d
OutputPlain text
[+] 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:

TerminalBash
docker compose -f ./n8n/compose.yml down -v
OutputPlain text
[+] 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.

TerminalBash
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

MistakeWhat happensDo this instead
Running the setup before Docker Desktop has startedThe setup stops with The Docker daemon is not runningOpen Docker Desktop, wait until it’s running, then run the setup again
Running the stop or start command from another foldercompose file "…/n8n/compose.yml" is invalid: open …: no such file or directoryGo back to the folder that holds the n8n folder
Adding -v when you only want to stop n8nAll your workflows and credentials are deletedStop with down alone
Running the setup again to restart n8nIt prints Found an existing install in ./n8n — leaving it untouched.Use the start command

Troubleshooting

ProblemCauseFix
Error: The Docker daemon is not runningDocker Desktop isn’t runningOpen Docker Desktop and run the setup again
something is already listening on port 5678Another program, often another n8n, already uses n8n’s portStop that program, then run the setup again
Docker Hub pull rate limit reachedToo many anonymous downloads from Docker HubThe setup’s own advice: wait about an hour, or sign in with docker login, then start n8n
The page shows Cannot GET right after startingn8n is still starting upWait 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

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