DEV Community

SWAPNIL AHMMED SHISHIR
SWAPNIL AHMMED SHISHIR

Posted on

Install n8n on Windows with Docker (Step-by-Step)

1) Install Docker Desktop (once)

  1. Download and install Docker Desktop for Windows.
  2. During install, keep WSL 2 enabled if prompted.
  3. After install, open Docker Desktop and ensure it says Running.
  4. In PowerShell run:
   docker --version
   docker compose version
Enter fullscreen mode Exit fullscreen mode

You should see version numbers.

Tip: If Docker says virtualization is disabled, enable it from BIOS and ensure Windows Subsystem for Linux + Virtual Machine Platform are turned on in Windows Features.

2) Quick test run (optional)

This runs n8n temporarily (data won’t persist). Good to verify everything works.

docker run --name n8n-test --rm -p 5678:5678 n8nio/n8n:latest
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:5678 — if it loads, you’re good. Press Ctrl+C to stop.

3) Persistent setup with Docker Compose (recommended)

This makes your data persist and lets you start/stop easily.

A) Create a project folder

mkdir $HOME\n8n
cd $HOME\n8n
Enter fullscreen mode Exit fullscreen mode

B) Create a .env file (settings)

Create a file named .env in this folder with these lines (edit as you like):

# n8n basic settings
GENERIC_TIMEZONE=Asia/Dhaka
N8N_HOST=localhost
N8N_PORT=5678
WEBHOOK_URL=http://localhost:5678/

# Optional: protect your local n8n with basic auth
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=admin
N8N_BASIC_AUTH_PASSWORD=ChangeThisStrongPassword123!
Enter fullscreen mode Exit fullscreen mode

C) Create docker-compose.yml

Create a file named docker-compose.yml in the same folder:

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    ports:
      - "${N8N_PORT:-5678}:5678"
    environment:
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - N8N_HOST=${N8N_HOST}
      - WEBHOOK_URL=${WEBHOOK_URL}
      - N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE}
      - N8N_BASIC_AUTH_USER=${N8N_BASIC_AUTH_USER}
      - N8N_BASIC_AUTH_PASSWORD=${N8N_BASIC_AUTH_PASSWORD}
    volumes:
      - n8n_data:/home/node/.n8n
    restart: unless-stopped

volumes:
  n8n_data:
Enter fullscreen mode Exit fullscreen mode

Notes
• Using a named volume (n8n_data) is the easiest on Windows—no path issues.
• Change the password/user in .env to something strong.

D) Start n8n

From the same folder:

docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Open: http://localhost:5678 🎉

E) View logs / stop / restart

docker compose logs -f
docker compose stop
docker compose start
docker compose down     # stops and removes the container (keeps volume/data)
Enter fullscreen mode Exit fullscreen mode

F) Update n8n later

docker compose pull
docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Common fixes

  • Port already in use (5678): Change N8N_PORT in .env (e.g., 5680) and run docker compose up -d again.
  • Can’t access in browser: Ensure Docker Desktop is running; check logs with docker compose logs -f.
  • Reset admin auth: Edit .env values and restart: docker compose up -d.

Top comments (0)