DEV Community

Nevik Schmidt
Nevik Schmidt

Posted on

How to Self-Host n8n with Docker in 10 Minutes (2026 Guide)

n8n is the best self-hosted automation tool available. Setup takes 10 minutes.

Prerequisites

  • A VPS (Hetzner CX22 = €4.15/month works perfectly)
  • Docker + Docker Compose
  • A domain name

docker-compose.yml

version: '3.8'
services:
  n8n:
    image: n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=n8n.yourdomain.com
      - N8N_PROTOCOL=https
      - WEBHOOK_URL=https://n8n.yourdomain.com/
      - GENERIC_TIMEZONE=Europe/Berlin
      - N8N_ENCRYPTION_KEY=your_32_char_key
      - DB_TYPE=postgresdb
      - DB_POSTGRESDB_HOST=postgres
      - DB_POSTGRESDB_DATABASE=n8n
      - DB_POSTGRESDB_USER=n8n
      - DB_POSTGRESDB_PASSWORD=secure_password
    volumes:
      - n8n_data:/home/node/.n8n
    depends_on:
      - postgres
  postgres:
    image: postgres:15
    restart: always
    environment:
      - POSTGRES_DB=n8n
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=secure_password
    volumes:
      - postgres_data:/var/lib/postgresql/data
volumes:
  n8n_data:
  postgres_data:
Enter fullscreen mode Exit fullscreen mode

Nginx Reverse Proxy

server {
    server_name n8n.yourdomain.com;
    location / {
        proxy_pass http://localhost:5678;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_read_timeout 300s;
    }
}
Enter fullscreen mode Exit fullscreen mode

Get SSL: certbot --nginx -d n8n.yourdomain.com

Start

docker compose up -d
Enter fullscreen mode Exit fullscreen mode

Visit https://n8n.yourdomain.com — setup wizard opens.

Cost

Resource Cost
Hetzner CX22 €4.15/mo
Domain ~€1/mo
SSL (Let's Encrypt) Free
Total ~€5/mo

vs Zapier at €20-200/mo for the same workflows.

Import Ready-Made Workflows

Once running, import and start immediately:

👉 Free AI Automation Starter Kit — 10 n8n workflows

Need custom n8n setup or workflow development? → nevki.de

Top comments (0)