7/7/2025 Aegis

How to Install n8n on Windows Using Docker (Localhost Setup)

n8n windows docker automation localhost tutorial

🖥️ Want to Try n8n on Your Windows PC?

If you’re just getting started with n8n, installing it on your Windows machine using Docker is the easiest and fastest way.

This guide will walk you through setting up n8n on localhost — perfect for testing workflows before deploying to production.

⚠️ Note: This setup runs locally only on your machine.
To access n8n from anywhere (via custom domain & SSL), you’ll need to map a subdomain and expose it. Contact me if you’d like help setting that up.


✅ What You’ll Need

  • Windows 10 or 11
  • Docker Desktop installed
  • Basic familiarity with the command line

📦 Step 1: Create a Docker Compose File

Create a new folder, for example:

C:\n8n

Inside that folder, create a new file called docker-compose.yml:

version: "3.1"

services:
  n8n:
    image: n8nio/n8n
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=admin
      - N8N_BASIC_AUTH_PASSWORD=yourpassword
      - N8N_HOST=localhost
    volumes:
      - ./n8n_data:/home/node/.n8n

🚀 Step 2: Run n8n

Open PowerShell or Command Prompt, navigate to your folder:

cd C:\n8n
docker compose up -d

This will download the image and start n8n in the background.


🌐 Step 3: Access n8n in Your Browser

Open your browser and visit:

http://localhost:5678

You should see the n8n login screen - use the credentials from your .yml file.


📁 Step 4: Persist Data

Your workflows, credentials, and executions are saved to the folder:

C:\n8n\n8n_data

You can back this up or copy it to another machine as needed.


🔒 Optional: Add Environment Variables

You can create a .env file in the same folder to manage secrets, API keys, or change the port. Then reference it inside docker-compose.yml with ${} syntax.


🌍 Want to Access n8n from the Internet?

By default, this setup is only accessible on your machine. To access it globally or with a custom domain:

  • You’ll need to expose the port through your router or use a reverse proxy like NGINX
  • You’ll need an SSL certificate for security
  • You’ll need DNS + domain setup

👉 Need help with that? I offer a complete domain mapping + reverse proxy + SSL setup service. Contact me here and I’ll get it done fast.


🧠 Final Notes

  • You can stop n8n at any time using:
docker compose down
  • n8n is perfect for testing locally before deploying to a VPS or cloud
  • For production use, I recommend a Linux VPS for better performance and uptime