Skip to main content
Docker is the recommended way to deploy n8n, providing a consistent environment and easy updates. This guide covers everything from simple deployments to production-ready setups.

Quick Start

Simple Docker Run

The fastest way to get n8n running:
1

Create a Docker volume

This persists your workflows, credentials, and settings between container restarts.
2

Run n8n container

3

Access n8n

Open your browser to http://localhost:5678
The /home/node/.n8n folder contains critical data including:
  • Encryption key for credentials
  • Webhook URLs
  • SQLite database (default)
  • User settings and configuration
Always persist this folder or your credentials cannot be decrypted after restart!

Docker Compose Deployments

Single Instance with PostgreSQL

A production-ready single instance setup:
Generate a secure encryption key:
Store this key securely! If lost, you cannot decrypt existing credentials.

With External Task Runners

Deploy n8n with isolated task runners for enhanced security:

Queue Mode (Scaling Setup)

Deploy n8n in queue mode with Redis and multiple workers:
Worker Scaling: Adjust deploy.replicas based on your execution volume. Monitor CPU and memory usage to determine the optimal number of workers.

Docker Image Options

n8n provides multiple Docker images:

ghcr.io/n8n-io/n8n

Official n8n image from GitHub Container Registry.Tags:
  • latest - Latest stable release
  • 1.x.x - Specific version (e.g., 1.25.0)
  • next - Latest unstable/beta release

Environment Variables for Docker

Key environment variables for Docker deployments:

Volume Mounts

Critical Data LocationsThe /home/node/.n8n directory contains:
  • config - Instance configuration
  • database.sqlite - Default database (if using SQLite)
  • .n8n.settings.json - Encryption key and settings
Always mount this directory to preserve data between restarts!

Updating n8n

1

Pull the latest image

2

Stop and remove old containers

This preserves your data volumes. Your workflows and credentials remain safe.
3

Start with new image

4

Verify the update

Check for successful startup and database migrations.
Before Updating:
  1. Check Breaking Changes
  2. Backup your database and encryption key
  3. Test updates in a staging environment first
  4. Plan for brief downtime during the update

Health Checks

n8n exposes a health check endpoint at /healthz:
The health endpoint checks:
  • Database connectivity
  • Redis connectivity (queue mode)
  • Application readiness
Returns HTTP 200 when healthy, 503 when unhealthy.

Timezone Configuration

Configure timezone for scheduled workflows:
  • GENERIC_TIMEZONE - Used by n8n’s Schedule node
  • TZ - System timezone for container commands

Custom SSL Certificates

Trust custom SSL certificates:
The entrypoint script automatically runs c_rehash on the certificate directory.

Troubleshooting

This happens when:
  • Encryption key changed or lost
  • /home/node/.n8n volume not mounted
  • Different encryption key between containers
Solution: Ensure consistent N8N_ENCRYPTION_KEY and persistent volumes.
Also consider:
  • Reducing N8N_CONCURRENCY_PRODUCTION_LIMIT
  • Adding more workers instead of increasing main process memory
  • Enabling execution data pruning

Next Steps

Configuration

Deep dive into all configuration options

Scaling

Learn about scaling with queue mode