Can you run n8n on Docker?

Quick Answer: Yes. n8n provides an official Docker image (n8nio/n8n) that can be run with a single command, supports persistent volumes for workflow data, and works with Docker Compose for production setups including PostgreSQL. Self-hosted n8n on Docker is free under the Sustainable Use License and is the recommended deployment path.

Running n8n on Docker

Docker is the recommended deployment method for self-hosted n8n. The official image is maintained by the n8n team and updated with each release.

Quick Start — Single Container

Run n8n with one command, storing data in a named volume:

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

Access the editor at http://localhost:5678.

Production Setup — Docker Compose

For production, use Docker Compose with PostgreSQL for data storage:

services:
  postgres:
    image: postgres:15
    environment:
      POSTGRES_USER: n8n
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: n8n
    volumes:
      - postgres_data:/var/lib/postgresql/data

  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "5678:5678"
    environment:
      DB_TYPE: postgresdb
      DB_POSTGRESDB_HOST: postgres
      DB_POSTGRESDB_USER: n8n
      DB_POSTGRESDB_PASSWORD: ${POSTGRES_PASSWORD}
      N8N_ENCRYPTION_KEY: ${N8N_ENCRYPTION_KEY}
    volumes:
      - n8n_data:/home/node/.n8n
    depends_on:
      - postgres

Recommended Environment Variables

  • N8N_ENCRYPTION_KEY: Encrypts credentials at rest
  • N8N_HOST: External hostname (for webhooks)
  • WEBHOOK_URL: Full URL for webhooks (important behind reverse proxy)
  • N8N_BASIC_AUTH_ACTIVE: Enables basic auth for the editor

Reverse Proxy

For public deployments, place n8n behind Caddy, Nginx, or Traefik for TLS termination. This is required for webhooks from external services.

Backup

  • Back up the PostgreSQL database nightly
  • Export workflows with the n8n CLI: n8n export:workflow --all --output=/backups
  • Store encryption key securely (loss = inability to decrypt credentials)

Scaling Considerations

  • Default single-instance runs webhook and worker processes together
  • For high throughput, enable "queue mode" with Redis and separate worker containers
  • Worker containers use the same image with --worker flag

Resource Requirements

  • Minimum: 1 vCPU, 1 GB RAM
  • Recommended for production: 2 vCPU, 4 GB RAM
  • Disk: 10 GB for database and logs

Related Questions

Last updated: | By Rafal Fila

Related Tools

Related Rankings

Best Open-Source Workflow Engines for Engineers in 2026

A ranked list of the best open-source workflow engines for engineers in 2026. This ranking evaluates code-first workflow orchestration platforms that engineers can self-host, extend, and embed inside existing software stacks. The ranking differs from the broader Best Open-Source Automation 2026 list by focusing specifically on workflow engines intended for developers: platforms that prioritize SDK coverage, durable execution, scalability, and operational controls over visual SaaS-connector automation. It includes durable execution engines (Temporal), data and task orchestrators (Apache Airflow, Prefect), low-code workflow builders with strong self-host stories (n8n, Windmill, Activepieces), and historical agent-based tools (Huginn).

Best Automation Tools for Healthcare in 2026

A ranked list of the best automation tools for healthcare organisations in 2026. This ranking evaluates platforms across HIPAA readiness, audit logging, PHI handling, on-premise or private-cloud deployment options, and integration with clinical and administrative systems. The ranking includes enterprise RPA (UiPath, Automation Anywhere), Microsoft-native automation (Power Automate), general-purpose workflow automation (Zapier on Business tier, Make, n8n self-hosted), and enterprise iPaaS (Boomi). Each entry is evaluated against the specific compliance, data-residency, and clinical-integration requirements that distinguish healthcare from other industries.

Dive Deeper