n8n: self-hosted workflow automation with Docker

n8n connects apps and APIs into automated workflows. What it replaces and how to install it on your own server with the official Docker setup.

n8n is a workflow automation tool. You build a workflow from nodes on a canvas: a trigger (a schedule, a webhook, a new email), then steps that call APIs, transform data or run your own code. It covers the same ground as Zapier or Make, but runs on your server, so there is no per-task pricing and the data does not leave your infrastructure.

n8n is source-available under its own Sustainable Use License, not an OSI open-source licence. Self-hosting for your own use is allowed; read the licence before offering it to others as a service.

What you need

  • Docker Engine with the Compose v2 plugin. Check with docker compose version.
  • At least 4 GB of RAM and 2 vCPUs. The official setup includes a sandbox for the n8n Assistant that runs Docker-in-Docker and needs the headroom.

Install

The n8n documentation recommends a one-line setup for new installs. Run it in the directory where the n8n folder should appear:

curl -fsSL https://get.n8n.io | sh

The script checks Docker, creates an n8n folder with compose.yml, searxng-settings.yml and an .env with generated secrets, pulls the images and starts everything. Running it again in the same place changes nothing.

What gets started:

Service Purpose
n8n The workflow editor on port 5678
runners Task runners that execute code nodes
sandbox-* The sandbox the n8n Assistant uses to run code
searxng Web search backend for the Assistant

There is no database service. n8n uses its built-in SQLite database, stored in the n8n-data Docker volume together with the encryption key. The documentation advises PostgreSQL for a production instance with many users or workflows running around the clock.

First run

Open http://<host>:5678 and create the owner account. For anything beyond a local test, put n8n behind a reverse proxy with HTTPS: webhooks from outside services need a public address.

The n8n Assistant stays off until you add a model provider key in the instance AI settings.

Stopping and updating

Stop the stack:

docker compose -f ./n8n/compose.yml down

The n8n version is pinned in ./n8n/.env as N8N_VERSION. To update, set it to the new release number and run:

docker compose -f ./n8n/compose.yml pull && docker compose -f ./n8n/compose.yml up -d

Backup

Back up the n8n-data volume. Without the encryption key stored there, saved credentials cannot be decrypted.