Home » n8n» Run n8n Locally with Docker or Node.js

Can n8n run locally?

Yes, n8n can run locally using Docker or Node.js. This guide shows a simple local setup, exact commands, and clear steps for beginners to start automation on their machine.

What You Need

  • Docker installed (recommended) or Node.js LTS.
  • Basic command line knowledge.
  • Optional: docker-compose for multi-container setup.

Can n8n run locally explained

Running n8n locally gives you full control for testing and development. Docker offers isolation and easy updates. Node.js lets you run n8n directly for quick tests.

How to Install and Run with Docker

Follow these numbered steps. Each step is short and clear.

1. Install Docker on your machine.

2. Pull the n8n image and run a container.

docker pull n8nio/n8n:latest
docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  n8nio/n8n:latest

3. Open http://localhost:5678 in your browser.

4. Stop the container with CTRL+C or:

docker stop n8n

Using docker-compose

Use docker-compose for persistent setups. Create a docker-compose.yml file and start with one command.

version: '3.1'
services:
  n8n:
    image: n8nio/n8n:latest
    ports:
      - 5678:5678
    volumes:
      - ~/.n8n:/home/node/.n8n
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=change_this
docker-compose up -d

How to Run n8n with Node.js

Use Node.js when you want to run n8n without Docker. This is good for quick trials.

1. Install Node.js LTS.

2. Install n8n globally or use npx.

npm install n8n -g
# or
npx n8n

3. Start n8n:

n8n start --tunnel
# or set a host and port
N8N_HOST=0.0.0.0 N8N_PORT=5678 n8n start

Step-by-step logic

1. Prepare environment (Docker or Node.js).

2. Persist data (use a volume or external DB).

3. Expose only needed ports.

4. Secure access before public exposure.

Update

Keep n8n up to date. For Docker, pull the new image and restart the container.

docker pull n8nio/n8n:latest
docker-compose pull
docker-compose up -d

For Node.js, update the package.

npm install -g n8n@latest

Security

Do not expose n8n to the public without protection. Use these basic steps:

  • Enable Basic Auth (N8N_BASIC_AUTH_*).
  • Run behind a reverse proxy with HTTPS.
  • Use strong passwords and environment secrets.
  • Limit network access and use a persistent database for production.

Done

You now know how to run n8n locally with Docker or Node.js. Use Docker for isolation and Node.js for quick tests. Start building automations on your local machine.


Neil
Written by Neil

Neil is a true n8n geek who lives and breathes workflow automation. He dives deep into nodes, triggers, webhooks, custom logic, and self-hosting setups, sharing everything he learns about n8n on AutomationCompare.com. As part of a broader team of automation specialists, Neil focuses purely on mastering n8n and helping others unlock its full potential.

Keep Reading

Scroll to Top