# How to Self-Host n8n with Docker (2026 Guide)

> To try n8n on your own computer, install Docker, run docker volume create n8n_data, then start the official n8nio/n8n image with port 5678 and that volume attached, and open http://localhost:5678. For a business server, use n8n's Docker Compose setup with HTTPS, switch to PostgreSQL, back up the data volume and pin the version you run. The current stable release on November 20, 2026 was 2.48.7. Self-hosting is allowed for your own internal business use under n8n's Sustainable Use License.

Format: howto · Published: 2026-11-20
URL: https://cognovaai.com/insights/how-to-self-host-n8n-with-docker

n8n is a workflow automation tool, similar to Zapier or Make, that you can run on your own server. Small businesses use it to connect forms, CRMs, email and AI models without paying per task. "n8n docker" and "n8n self hosted" are searched about 1,900 and 1,300 times a month in the US, according to Semrush.

This guide follows n8n's own documentation and release notes as published on November 20, 2026. It is for business owners deciding between n8n Cloud and self-hosting, and for the technical person who will set it up. n8n's docs warn that self-hosting requires technical knowledge, and that mistakes can cause data loss, security problems and downtime. Docker was not installed on the PC we used for this article, so we did not run these commands ourselves.

## What you need

- Docker Desktop (Mac, Windows or Linux) or Docker Engine with Docker Compose v2 on a Linux server
- At least 4 GB of RAM and 2 vCPUs for n8n's Compose setup
- For a public server, a domain name with an A record for a subdomain such as n8n.yourcompany.com
- Someone comfortable with the command line, containers and server security

**Time needed:** 15 minutes for a local test, 1–2 hours for a production server

## Step 1: Decide between n8n Cloud and self-hosting

n8n's license lets you self-host and modify n8n for your own internal business purposes, but not resell it as a hosted service to customers without an agreement. On November 20, 2026 n8n's pricing page listed Cloud Starter at €20 a month and Pro at €50 a month, both billed annually, and a self-hosted Business plan at €667 a month. The free Community Edition is the self-hosted version on GitHub. Choose Cloud if nobody on your team manages servers.

## Step 2: Install Docker

Install Docker Desktop, which n8n's docs note includes Docker Engine and Docker Compose, or install Docker Engine and the Compose plugin on a Linux server. Check Compose with `docker compose version`. On Windows, n8n's Compose guide says to use WSL with the WSL2 backend and keep the n8n project folder inside the WSL file system rather than under `/mnt/c`.

## Step 3: Run a quick local test

Create a volume so your data survives restarts with `docker volume create n8n_data`, then start n8n with the `docker run` command shown in the code block below, replacing the timezone with yours, for example `America/Chicago` for Dallas. The command maps port 5678 and stores n8n's data, including its encryption key, in the volume. Run it in a Linux, macOS or WSL terminal, because the line breaks use backslashes.

## Step 4: Open n8n and create the owner account

Open http://localhost:5678 in your browser, as n8n's Docker page instructs, and follow the setup screens to create your account. Build a small test workflow, such as a schedule trigger that writes a timestamp, to confirm everything runs. Stop the test container with Ctrl+C; the data stays in the `n8n_data` volume.

## Step 5: Set up a production server with Docker Compose

For a server reached over the internet, follow n8n's Docker Compose guide for cloud servers. It creates an `n8n-compose` folder and a `.env` file with your domain, subdomain, timezone and an email for the SSL certificate, plus a `compose.yaml` that runs n8n behind Traefik, which issues the HTTPS certificate. Copy `compose.yaml` from n8n's page rather than retyping it, then start it with `sudo docker compose up -d`.

## Step 6: Use PostgreSQL for real workloads

n8n uses SQLite by default. Its Compose docs say SQLite is fine for trying things out, but production instances with more than a handful of users or workflows running around the clock should use Postgres. n8n connects to Postgres through `DB_TYPE=postgresdb` and the `DB_POSTGRESDB_` settings. Existing SQLite data does not move across automatically, so choose Postgres before you build important workflows.

## Step 7: Protect the encryption key and back up

n8n encrypts saved credentials with a key it generates and stores in `/home/node/.n8n`, the folder mapped to your data volume. If that folder is lost, n8n creates a new key and your saved credentials can no longer be decrypted. Back up the volume or set your own `N8N_ENCRYPTION_KEY` and store it in a password manager. With Postgres, back up the database too, and always before an upgrade.

## Step 8: Update deliberately

Pin a specific version in your setup rather than always pulling the newest image, read the release notes, then update. n8n's docs give `docker compose pull`, `docker compose down` and `docker compose up -d`, run from the Compose folder. n8n publishes a stable and a beta release; on November 20, 2026 these were 2.48.7 and 2.49.3. Run stable in production.

## The quick-start commands

These are the commands from n8n's "Install with Docker" page. Replace `<YOUR_TIMEZONE>` with a timezone name such as `America/Chicago`:

```bash
docker volume create n8n_data

docker run -it --rm \
 --name n8n \
 -p 5678:5678 \
 -e GENERIC_TIMEZONE="<YOUR_TIMEZONE>" \
 -e TZ="<YOUR_TIMEZONE>" \
 -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
 -v n8n_data:/home/node/.n8n \
 n8nio/n8n
```

`GENERIC_TIMEZONE` controls when scheduled workflows run. `TZ` sets the system clock inside the container. If you do not set a timezone, n8n defaults to New York time.

## The production .env file

n8n's cloud-server guide uses an `.env` file like this, with your own values:

```bash
DOMAIN_NAME=example.com
SUBDOMAIN=n8n
GENERIC_TIMEZONE=Europe/Berlin
SSL_EMAIL=user@example.com
```

With these values, n8n would be served at `https://n8n.example.com`. The `compose.yaml` on the same page sets `N8N_WEBHOOK_URL` from these values so webhooks use your public address. n8n notes that versions before 2.30.0 use `WEBHOOK_URL` instead.

## A safe update routine

1. Read the release notes for the version you are moving to.
2. Back up the data volume, and the Postgres database if you use one.
3. Change the pinned version in your `.env` or compose file.
4. Run `docker compose pull`, `docker compose down`, then `docker compose up -d`.
5. Open n8n and run one or two important workflows by hand to confirm they still work.

## What we did and did not test

Docker was not installed on the Windows 11 PC used for this article, and we did not install it, so none of these commands were run for this guide. They are copied from n8n's documentation as published on November 20, 2026. Version numbers come from n8n's GitHub releases page on the same date.

## How Cognova AI can help

We design, build and host n8n workflows for small businesses, including AI agents, lead routing, document processing and connections to voice and chat agents, with backups and monitoring handled. See [AI Roadmaps for Service Businesses](/services/ai-roadmap-service-businesses), [AI Chatbot Development](/services/ai-chatbot-development) or [AI Voice Agents](/services/ai-voice-agents).

## Frequently asked questions

### Is self-hosted n8n free for business use?

The Community Edition costs nothing to download, and n8n's Sustainable Use License allows you to use and modify it for your own internal business purposes. You still pay for the server, and you are responsible for security, backups and updates. Offering n8n to your own customers as a hosted product needs a separate agreement with n8n. Some enterprise features need a paid licence.

### How much server do I need to self-host n8n?

n8n's Docker Compose guide asks for at least 4 GB of RAM and 2 vCPUs. That is enough for a small business running a handful of workflows. Heavier use, such as many workflows running around the clock or AI steps processing large files, needs more, along with PostgreSQL instead of the default SQLite database. Start small and watch memory use.

### Should a small business use n8n Cloud or self-host?

Choose n8n Cloud if nobody on your team manages servers. It removes patching, backups and HTTPS setup, and pricing started at €20 a month billed annually on November 20, 2026. Self-host if you need data to stay on your own infrastructure, want to avoid execution limits, or already have someone who runs servers. n8n's own docs recommend Cloud for people without server experience.

## Sources

- [n8n Docs: Install with Docker](https://docs.n8n.io/deploy/host-n8n/install-options/install-with-docker)
- [n8n Docs: Install using Docker Compose](https://docs.n8n.io/deploy/host-n8n/install-options/install-using-docker-compose)
- [n8n Docs: Docker Compose on a cloud server](https://docs.n8n.io/deploy/host-n8n/install-options/use-a-cloud-provider/use-docker-compose)
- [n8n releases (GitHub)](https://github.com/n8n-io/n8n/releases)
- [n8n Sustainable Use License](https://github.com/n8n-io/n8n/blob/master/LICENSE.md)
- [n8n Docs: Community license FAQ](https://docs.n8n.io/n8n-community-license/)
- [n8n pricing](https://n8n.io/pricing)
- [Semrush Keyword Overview: n8n docker (US database, November 2026)](https://www.semrush.com/analytics/keywordoverview/?q=n8n+docker&db=us)
