Development · Tip

n8n Docker Self-Hosting & HTTP Cheat Sheet

Quick command reference for running n8n via Docker and configuring environments.

A concise reference guide detailing common Docker commands and essential environment variables for self-hosting n8n. It covers deployment commands, persistence volumes, core settings like SMTP and webhooks, and cURL import patterns for HTTP Request nodes.

How it works

Docker self-hosting:

# Install n8n docker

git clone https://github.com/n8n-io/self-hosted-ai-starter-kit.git

cd self-hosted-ai-starter-kit

# Update latest version

sudo docker pull docker.n8n.io/n8nio/n8n

# Stop container

sudo docker stop n8n

# Remove container

sudo docker rm n8n

# Docker Run (interactive mode, auto-restart policy, continues run, port mapping, persistent volume)

sudo docker run -it --rm --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n

Env vars: WEBHOOK_URL (public webhook URL), N8N_SMTP_HOST/N8N_SMTP_PORT=465/N8N_SMTP_USER (SMTP port and user email), N8N_SMTP_PASS (SMTP app password), N8N_SMTP_SENDER (email sender), N8N_SMTP_SSL="true" (enable SSL for SMTP).

GENERIC_TIMEZONE=Asia/Seoul (set timezone), N8N_DIAGNOSTICS_ENABLED=false (disable diagnostics), N8N_VERSION_NOTIFICATIONS_ENABLED=false (disable version check), VUE_APP_URL_BASE_API (frontend base API URL).

N8N_ENCRYPTION_KEY (random strings, encryption key), N8N_TEMPLATES_ENABLED=false (disable templates), N8N_USER_FOLDER=/home/n8n (user folder path).

EXECUTIONS_TIMEOUT=3600 (execution timeout s), EXECUTIONS_TIMEOUT_MAX=7200 (max execution timeout s).

N8N_METRICS=true (Prometheus metrics), N8N_CUSTOM_EXTENSIONS="/home/n8n/n8n-custom-nodes; /data/n8n-nodes" (custom nodes path), N8N_FUNCTION_ALLOW_BUILTIN=* (allow built-in modules).

HTTP Request (API): Import cURL command — one-click auto fill. Example:

curl -X POST https://api.example.com/data \

-H "Content-Type: application/json" \

-H "Authorization: Bearer YOUR_API_TOKEN" \

-d '{"name": "Alice", "email": "alice@example.com"}'

What it's for

  • Deploy or update a self-hosted n8n instance using Docker
  • Configure key n8n environment variables for webhooks, email, and security
  • Import raw cURL commands directly into n8n HTTP Request nodes

Key points

  • Docker commands for cloning the starter kit, pulling updates, and managing containers
  • One-line docker run command with port mapping and volume persistence
  • Essential environment variable reference for SMTP email delivery and webhooks
  • Security and system tuning flags for encryption keys, timeouts, and metrics
  • Example cURL payload structure for importing into the HTTP Request node

Pricing

Free

Details

Type
Tip
Category
Development
Topic
DevOps & Sysadmin
Open source
Yes
Platforms
Linux, Command line, Self-hosted
For
Developers and system administrators self-hosting workflow automation tools
Tags
n8n, docker, automation, cheat sheet, self hosted

Why it was saved

  • @boringmarketer, 14 April 2025: Copy-paste commands and patterns for running n8n yourself and wiring APIs.

Related

Updated