n8n Docker self-hosting guide: one-line setup, Compose, PostgreSQL, and a production checklist
n8n's recommended Docker install is now one command, curl -fsSL https://get.n8n.io | sh. Learn the three Docker routes, Windows setup, the SQLite and sandbox defaults, switching to PostgreSQL, upgrades, and what to secure before production.
n8n's recommended Docker setup is now a single command: with Docker installed, run curl -fsSL https://get.n8n.io | sh, and the script creates an n8n folder, writes compose.yml and .env, pulls the images, and starts everything at http://localhost:5678. When you need full control, build the Docker Compose setup by hand using n8n's guide. This article follows n8n's official documentation to compare the three Docker routes, walk through each, explain upgrades, and list the database, reverse proxy, and security work required before production.
First check whether self-hosting suits you
The n8n docs open the Docker page with a warning: self-hosting requires knowing how to set up servers and containers, manage resources and scaling, secure servers and applications, and configure n8n. n8n recommends self-hosting for expert users because mistakes can cause data loss, security issues, and downtime, and points less experienced users to n8n Cloud. A separate Toolvori article compares Community and Cloud Starter costs; this one covers deployment only.
The install channel is also changing. The one-line setup page says the command replaces the old npm install n8n and npx n8n approach, which no longer works from n8n 3.0, when n8n will be distributed only through Docker. Existing npm installs keep working for now, but new installs and future upgrades should use Docker. When we checked, the Docker page listed the current stable release as 2.47.7 and beta as 2.48.4; stable is for production and beta may be unstable.
Choosing among the three Docker routes
One-line setup is the fastest route for fresh installs and needs no Docker knowledge, only Docker running; the script generates configuration and secrets. Manual Docker Compose suits people who want full control or need to fold n8n into an existing Compose project. Single-container docker run still works for a quick look, but the official Docker page is now marked "This content is outdated" and points to Docker Compose as the recommended method.
For docker run, the page creates a volume with docker volume create n8n_data, runs the n8nio/n8n image on port 5678, and mounts the volume at /home/node/.n8n so data survives restarts. Set both timezone variables to your real zone, for example Asia/Singapore: TZ controls system time, and GENERIC_TIMEZONE sets the zone used by schedule-oriented nodes such as the Schedule Trigger.
Rule of thumb: first deployment, use the one-line setup. Already running your own Compose file, keep it; the docs say you do not need to switch. Need PostgreSQL or custom networking, build Compose by hand.
