n8n setup
Follow n8n’s installation documentation for the latest image tags and options. Below is a concise production-oriented summary.
Prerequisites
- Docker — Docker Desktop or Linux Docker Engine + Compose.
- Timezone — Set
TZandGENERIC_TIMEZONEso schedules run correctly (timezone docs).
n8n publishes images at docker.n8n.io/n8nio/n8n. The docs show stable vs beta tracks; use stable for production (Docker page).
Single-container quick start
Create a volume and run n8n (replace the timezone):
docker volume create n8n_data
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-e GENERIC_TIMEZONE="America/New_York" \
-e TZ="America/New_York" \
-e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
-e N8N_RUNNERS_ENABLED=true \
-v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
Open http://localhost:5678. The official example enables runners and settings file permissions enforcement—keep these for new deployments unless you have a reason not to (source).
Persistence: The /home/node/.n8n volume holds encryption material, logs, and other state—even when using PostgreSQL, n8n still recommends persisting this directory (Docker page).
PostgreSQL (Docker run)
For PostgreSQL, set DB_TYPE=postgresdb and the DB_POSTGRESDB_* variables. Example skeleton:
docker run -d \
--name n8n \
-p 5678:5678 \
-e TZ="America/New_York" \
-e GENERIC_TIMEZONE="America/New_York" \
-e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
-e N8N_RUNNERS_ENABLED=true \
-e DB_TYPE=postgresdb \
-e DB_POSTGRESDB_DATABASE=<DB_NAME> \
-e DB_POSTGRESDB_HOST=<HOST> \
-e DB_POSTGRESDB_PORT=5432 \
-e DB_POSTGRESDB_USER=<USER> \
-e DB_POSTGRESDB_PASSWORD=<PASSWORD> \
-e DB_POSTGRESDB_SCHEMA=<SCHEMA> \
-v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
Official Compose examples live in the n8n-hosting repository (e.g. docker-compose/withPostgres).
Docker Compose
Compose is the usual production baseline: n8n + Postgres + reverse proxy (see Deploy). Pull updates with:
docker compose pull
docker compose down
docker compose up -d
Local npm (development)
For UI or node development, some teams run from source or npm; do not treat dev setups as production—tunnel features and dev defaults are unsafe for the internet (tunnel warning).
Next steps
- Configuration — Encryption key,
WEBHOOK_URL, database tuning - Security — Auth and exposure