n8n Docker Setup: 6 Powerful Steps to Self-Host (2026)

A step-by-step guide to self-hosting n8n with Docker, including why it's about to become mandatory.

by xvifs.com

Setting up n8n Docker hosting is now the standard, officially recommended way to self-host n8n — and starting with n8n 3.0, scheduled for October 2026, it becomes the only supported way. If you’re still running n8n via npm or npx, this guide covers both the migration and a fresh setup.

n8n Docker installation command setup

Why Docker Is No Longer Optional

n8n’s own changelog is direct about this: self-hosted n8n will require a Docker-based deployment starting with version 3.0. Installations run via npm or npx n8n will no longer be supported from that release forward. If you currently run n8n through npm, the official guidance is to plan a move to Docker before upgrading — Docker Compose is described as the easiest path for local installations.

This isn’t just a packaging preference. n8n recommends Docker for self-hosting generally because it provides a clean, isolated environment, avoids operating system and tooling incompatibilities, and simplifies database and environment management — reasons that apply whether or not the npm option still existed.

Two Ways to Get n8n Docker Running

n8n’s official docs point to two main paths, depending on how much control you want over the setup.

The One-Line Setup (Fastest Start)

This is a newer method that replaces the old npm-based quick start. It sets up a brand-new n8n instance with a single command and is meant for fresh installs, not for modifying an existing setup. It requires the Docker Compose v2 plugin specifically — the newer, integrated version, not the older standalone docker-compose binary — and checks that the Docker daemon is actually running before proceeding.

Docker Compose (More Control)

If you’re setting up something more permanent, or already run other services via Docker Compose, this is the path n8n recommends. You define your own Compose file, giving you direct control over volumes, environment variables, networking, and how n8n sits alongside a database or reverse proxy.

Step-by-Step: Basic n8n Docker Setup

Step 1: Install Docker

You need Docker installed and running — Docker Desktop covers Mac, Windows, and Linux with a GUI, while Docker Engine and Docker Compose are available as separate packages for Linux servers without a graphical environment.

Step 2: Choose Your Installation Method

Use the one-line setup command for the fastest fresh install, or write your own Docker Compose file if you want more control from the start.

Step 3: Persist Your Data

n8n’s official Docker setup mounts a dedicated n8n_data volume to the /home/node/.n8n directory inside the container. This is what makes your workflows, credentials, and settings survive a container restart — skip this step and a routine restart wipes everything.

Step 4: Set Your Timezone Variables

Two separate environment variables control time in n8n: TZ sets the system timezone that controls what scripts and commands like date return, while GENERIC_TIMEZONE sets the timezone used specifically by schedule-oriented nodes like the Schedule Trigger. Missing the second one is a common cause of scheduled workflows firing at the wrong time.

Step 5: Expose the Right Port

n8n’s Docker container maps and exposes port 5678 by default — this is the port you’ll connect to in your browser, whether that’s localhost during testing or your server’s domain once you’re running in production behind a reverse proxy.

Step 6: Enable Task Runners

n8n’s official Docker documentation describes task runners as the recommended way of executing tasks in n8n going forward. Enabling this at setup, rather than retrofitting it later, avoids a configuration change on a system that’s already running production workflows.

Community, Business, and Enterprise: Same Core Product

Every self-hosted n8n Docker installation runs the identical core product. Without a license key, you get the free Community edition. Adding a Business or Enterprise license key unlocks those tiers’ additional features on that same installation — there’s no separate Docker image to switch to later, which keeps a licensing upgrade simple if your needs grow.

A Detail That Matters If You Scale to Queue Mode

If you later scale your n8n Docker setup into queue mode (running multiple workers to handle higher workflow volume), there’s a specific configuration requirement worth knowing before you get there: n8n does not support filesystem mode for binary data when running in queue mode, even across a shared volume. The database-backed binary data mode (N8N_DEFAULT_BINARY_DATA_MODE=database) is required instead. This isn’t a concern for a single-instance setup, but it’s worth planning for if horizontal scaling is on your roadmap.

Rolling Back After an Update

One safety detail that’s easy to overlook: n8n’s database migrations are forward-only, with no documented downgrade path. Pinning your Docker image back to a previous version tag only gives you a real rollback if no database migration ran during the update you’re reverting. If one did run, a genuine rollback requires restoring your database from a backup taken before the update — not just switching the image tag back. Take a database backup before every update, not just the risky-looking ones.

Common Setup Mistakes to Avoid

A handful of issues account for most n8n Docker setup problems reported by self-hosters. The most common by far is forgetting the persistent volume mount entirely — everything works fine until the first server reboot or container update, at which point workflows and credentials simply vanish because they were only ever stored inside the container’s ephemeral filesystem.

The second is running the older standalone docker-compose binary instead of the Docker Compose v2 plugin the one-line setup script specifically checks for. If you installed Docker some time ago and haven’t updated it, verify you have the integrated docker compose command (no hyphen) rather than the legacy docker-compose tool before running n8n’s setup script.

The third is skipping a reverse proxy and exposing port 5678 directly to the internet without HTTPS. n8n handles workflow credentials and webhook data — running it over plain HTTP on a public IP is a genuine security exposure, not just a best-practice suggestion.

A Realistic Setup Scenario

A small team wants to self-host n8n for internal automations — connecting their CRM, Slack, and a few internal APIs — on a $10/month VPS. They install Docker, run the one-line setup for a fast initial instance, then migrate to a proper Docker Compose file once they need a Postgres database and an Nginx reverse proxy with a real domain and SSL certificate.

They set both TZ and GENERIC_TIMEZONE to their local timezone so scheduled reports fire at the right hour, mount the persistent volume from day one, and set a weekly database backup as a cron job before ever touching a version update. Total monthly cost: the VPS itself, with n8n’s Community edition running unlimited workflows for free.

n8n Docker data persistence and backup

Is Self-Hosting Actually Right for You?

n8n’s own documentation is candid about this: self-hosting is recommended for expert users, and mistakes in a self-hosted setup can lead to data loss, security issues, and downtime. If you aren’t experienced managing servers, n8n’s official recommendation is to use n8n Cloud instead — the managed option covered in our n8n overview and n8n vs Zapier comparison.

That’s not a reason to avoid Docker self-hosting if you have the capacity for it — it’s a genuine cost and control advantage, covered in more depth in our Make.com vs n8n comparison. It’s simply a real tradeoff worth being honest with yourself about before committing production workflows to a server you’re personally responsible for keeping online.

Frequently Asked Questions

Is npm installation for n8n still supported?

It still works for existing installs, but it’s deprecated starting with n8n 3.0 (scheduled for October 2026), after which self-hosted n8n requires a Docker-based deployment. New installs should use Docker now rather than npm.

What port does n8n Docker use by default?

Port 5678. Your Docker setup maps and exposes this port, which is what you connect to in your browser whether you’re running locally or on a remote server behind a domain.

Will my workflows survive if I restart the n8n Docker container?

Only if you’ve mounted the n8n_data volume to /home/node/.n8n as n8n’s official setup does by default. Without a persistent volume, a container restart wipes your workflows, credentials, and settings.

Can I roll back to a previous n8n Docker version if an update breaks something?

Only safely if no database migration ran during the update — migrations are forward-only with no documented downgrade path. Always take a database backup before updating, so a genuine rollback is possible if needed.

Do I need Docker Compose, or is the one-line setup enough?

The one-line setup is fine for a fresh, simple instance and is genuinely the fastest way to get n8n Docker running. Move to a full Docker Compose file once you need more control — a dedicated Postgres database, a reverse proxy, custom networking, or integration into an existing Compose-based stack.

Setting up n8n Docker hosting correctly the first time — persistent volumes, correct timezone variables, and a real backup habit before updates — avoids the most common ways a self-hosted instance loses data. With n8n 3.0 making Docker mandatory later in 2026, it’s also simply where every self-hosted n8n setup is headed regardless of preference.

Sources

Related Articles

Related Posts

Leave a Comment

XVIFS helps businesses, marketers, creators, and entrepreneurs discover practical AI tools, SaaS platforms, automation solutions, and digital marketing strategies. Explore our tutorials, software reviews, comparisons, and step-by-step guides designed to help you work smarter, automate faster, and grow your business online.

Email: info@xvifs.com

© 2026 XVIFS. AI Tools, SaaS & Automation Guides. All Rights Reserved.