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

Written & reviewed by Rafal Fila · Last updated:

Related Tools

Related Rankings

Best Human-in-the-Loop Automation Platforms 2026

Eight platforms are ranked here on a single mechanism: how a person enters an automated path, and what the system can prove afterward about the decision they made. Moxo scores 7.7 and ranks first; Camunda 8 scores 7.2, Microsoft Power Automate 7.1, Pega 6.9, n8n 6.7, Zapier 5.9, Kissflow 5.8 and ServiceNow 4.8, scored 22 September 2026 on the five weighted criteria. Those criteria cover the step type, the approver's account or licence, the routes available on a rejection, the audit record, and the meter that charges for the decision, and none of them can tell a review from a rubber stamp, so the methodology adds a check readers can run on any product in a few minutes: whether the decision record tells a considered approval from an instant one. Every figure was read from a vendor-owned surface and carries its own date.

Best Automation Platforms for AI Orchestration 2026

This ranking answers one question: how many real business applications can an AI agent act on out of the box? It evaluates nine platforms as of August 2026 on the reach they give an agent, not on the workflow logic they can express. That boundary is deliberate, because two neighbouring pages on this site answer different questions. Best Process Orchestration Platforms 2026 scores multi-step process control, error handling and state management. Best AI Agent Platforms 2026 scores building and hosting the agent itself. This page scores the layer between them: the connective tissue that lets an agent already built elsewhere reach the applications a business actually runs on. A platform that leads one of those pages can place low here, and two of them do. Scores derive from application and action catalogue counts, the exposure model each platform uses to publish those catalogues to an agent, setup effort, failure handling and cost per agent action. Every figure was retrieved from a vendor-owned surface on 11 August 2026 unless an earlier date is stated against it.

Dive Deeper