Self-hosting n8n gives the operator control over infrastructure and data location, but also transfers responsibility for access control, TLS, updates, encryption keys, backups and incident response. This guide uses the official Docker image for a private learning deployment and then explains what must change before exposing webhooks or handling important data. Instructions were checked against official n8n documentation on 20 July 2026.

Prerequisites and scope

  • A maintained host with Docker and Docker Compose, enough storage for application data and backups, and an administrator who can install updates.

  • A private test environment. Do not begin with production credentials, customer records or an internet-facing port.

  • For public use, a domain, HTTPS reverse proxy, firewall policy and a documented restore process.

  • A secure place for the n8n encryption key and any database credentials; losing the encryption key can make stored credentials unusable.

The safe example creates a Manual Trigger connected to an Edit Fields node that returns a fixed demonstration message. It calls no external service and stores no secret. The expected result is one successful manual execution whose output contains `status: ready`. This confirms the editor, execution engine and persistent data directory are working without granting the workflow consequential permissions.

Step 1: create persistent configuration

Create a dedicated folder and a Compose file. Bind the editor only to localhost for the learning setup; do not open port 5678 on a public firewall. The named volume preserves n8n data across container replacement. Set an explicit timezone appropriate to the operator. Generate a long random encryption key outside the Compose file and provide it through a protected environment file or secret mechanism.

services:
  n8n:
    image: docker.n8n.io/n8nio/n8n:latest
    ports:
      - '127.0.0.1:5678:5678'
    environment:
      - GENERIC_TIMEZONE=UTC
      - TZ=UTC
      - N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
    volumes:
      - n8n_data:/home/node/.n8n
volumes:
  n8n_data:

Using `latest` is convenient for a first local run but not a controlled update strategy. Before ongoing use, pin a reviewed n8n version and change it deliberately after reading release notes. Protect the environment file with operating-system permissions, keep it out of Git and store a recoverable copy of the encryption key separately from the server backup.

Step 2: start locally

docker compose up -d
docker compose logs --tail=100 n8n

Open `http://127.0.0.1:5678` from the host and create the owner account through the displayed setup flow. Use a unique password. If the editor must be reached from another machine, do not simply change the binding to all interfaces; place it behind a properly configured HTTPS reverse proxy, restrict administrative access and set the documented deployment environment variables for the public URL.