✳️Replace the highlighted information with your own
### .env
POSTGRES_DB=n8n_db
POSTGRES_USER=n8n_db_user
POSTGRES_PASSWORD=n8n_db_PWD
N8N_PORT=5678
N8N_PROTOCOL=http
N8N_HOST=0.0.0.0
GENERIC_TIMEZONE=Asia/Ho_Chi_Minh
TZ=Asia/Ho_Chi_Minh
N8N_ENCRYPTION_KEY=your_secret_key_here
N8N_EDITOR_BASE_URL=http://IP-WSL:5678
WEBHOOK_URL=http://IP-WSL:5678
N8N_SECURE_COOKIE=false
### docker-compose.yml
services:
postgres:
image: postgres:16
container_name: n8n_postgres
restart: unless-stopped
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
TZ: ${TZ}
volumes:
- ./postgres_data:/var/lib/postgresql/data
n8n:
image: n8nio/n8n:latest
container_name: n8n
restart: unless-stopped
ports:
- "${N8N_PORT}:5678"
environment:
DB_TYPE: postgresdb
DB_POSTGRESDB_HOST: postgres
DB_POSTGRESDB_PORT: 5432
DB_POSTGRESDB_DATABASE: ${POSTGRES_DB}
DB_POSTGRESDB_USER: ${POSTGRES_USER}
DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD}
N8N_HOST: ${N8N_HOST}
N8N_PORT: ${N8N_PORT}
N8N_PROTOCOL: ${N8N_PROTOCOL}
N8N_SECURE_COOKIE: ${N8N_SECURE_COOKIE}
WEBHOOK_URL: ${WEBHOOK_URL}
N8N_EDITOR_BASE_URL: ${N8N_EDITOR_BASE_URL}
GENERIC_TIMEZONE: ${GENERIC_TIMEZONE}
TZ: ${TZ}
N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
depends_on:
- postgres
Read more
- How to Self-Host n8n on Windows Using WSL and Docker
- How to Fix the Pairing Required Error in OpenClaw with Docker
- How to Boost Your Raspberry Pi Performance by Booting from USB or External Drive
- Fix the ‘Device Signature Expired’ Error in OpenClaw
- How to Access the OpenClaw Dashboard from ANYWHERE
- Enable Windows Subsystem for Linux (WSL) on Windows
- Banana Pi M2 Zero: A Compact Powerhouse for Your Projects
- Installing OpenClaw on Ubuntu Linux
- Top 10 Linux Server Management Tools for Efficient Administration
- How to Create Your OpenAI API Key: A Step-by-Step Guide