n8n Docker: How to Install and Run Step-by-Step
You have heard that n8n is the most powerful open-source automation platform available, and you want to run it yourself. Smart move. But here is the reality most guides skip: spinning up n8n Docker without understanding the full picture leads to lost workflows, broken webhooks, and hours of frustrating troubleshooting. Whether you are a solopreneur automating client onboarding or a freelancer connecting APIs for the first time, this guide walks you through every step of installing and running n8n in Docker, from checking your hardware to building your first working workflow. No fluff, no assumptions, just the exact commands and configurations you need to get n8n running reliably.
This is the guide I wish existed when I first set up n8n Docker on my own machine. It covers the real system requirements (not the misleading minimums), the exact installation steps for every operating system, a production-ready PostgreSQL setup, security configuration, your first workflow, and a complete troubleshooting reference. If you have followed my n8n self-hosted setup guide, consider this the deep-dive companion specifically for Docker-based installations.
Most Valuable Takeaways
- The official 2GB RAM minimum is for testing only — production n8n Docker installations need 8GB RAM minimum, and 16GB delivers smooth performance for small teams running 10+ workflows.
- Volume mapping is the number one cause of data loss — skip the docker volume create command and you lose every workflow, credential, and execution history when the container restarts.
- Your encryption key is irreplaceable — losing your N8N_ENCRYPTION_KEY makes all stored API keys, OAuth tokens, and passwords permanently unrecoverable. Back it up separately from your Docker files.
- Local Docker cannot receive external webhooks — without a public URL from Ngrok, Railway, or Cloudflare Tunnels, external services cannot trigger your workflows.
- PostgreSQL is required for production — the default SQLite database works for testing, but a Docker Compose setup with PostgreSQL prevents data loss during container updates.
- Self-hosting is not free — realistic production costs run $50–$150 per month for infrastructure, backups, and maintenance. For non-technical solopreneurs, n8n Cloud at $20–$24 per month is often the smarter investment.
Check If Your Computer Can Actually Run n8n Docker (Do Not Skip This)
Before you touch a single Docker command, you need to know whether your hardware can handle n8n in production. The official n8n documentation lists 2GB RAM and 2 CPU cores as the minimum. That is technically true for opening the interface and running a test workflow. But based on extensive community reports, that setup crashes within two to three weeks of regular use as execution logs, credential data, and workflow configurations consume available memory.
Here is what actually works for different use cases when running n8n Docker:
- Testing and learning (1–3 simple workflows) — 4GB RAM, 2 CPU cores. Fine for following this guide and experimenting. Not suitable for anything running on a schedule.
- Solopreneur production (5–15 workflows) — 8GB RAM, 4 CPU cores minimum. This handles daily scheduled workflows, webhook triggers, and moderate API calls without memory exhaustion errors.
- Small team production (15–50 workflows) — 16GB RAM, Intel i7 or equivalent, 4+ CPU cores. Community members running this configuration consistently report smooth performance with comfortable headroom.
The Real Cost of Self-Hosting n8n Docker
Self-hosting sounds free, but it is not. Here is what you actually pay:
- Cloud VPS (if not running locally) — $50–$80 per month for a server with adequate RAM and CPU.
- Storage and backups — $30–$60 per month for database backups, workflow exports, and disaster recovery.
- Domain and SSL — $12 per year for a domain, free SSL with Let’s Encrypt.
- Your time — 5–20 hours per month for maintenance, updates, and troubleshooting. At $50–$100 per hour, that is $250–$2,000 in labor.
For solopreneurs on tight budgets, the cheapest viable paths are Railway at $5–$10 per month (five-minute setup, PostgreSQL included) or a Hetzner ARM64 CAX11 server at approximately $4 per month. If you want zero infrastructure headaches, n8n Cloud starts at $20 per month and includes everything.
Decision Tree: Should You Use Docker?
- Do you have 8GB or more RAM and want full control over your data? Proceed with this Docker guide.
- Do you have less than 8GB RAM or no Docker experience? Consider n8n Cloud at $20–$24 per month instead.
- Are you technical but on a tight budget? Deploy to Railway for $5–$10 per month with their pre-built n8n template.
- Do you need webhooks from external services? Local Docker alone will not work. You need a public URL solution (covered later in this guide).
Install Docker Desktop on Your Operating System
Docker Desktop installation takes 5 to 15 minutes and requires administrator access on all platforms. Docker Desktop includes Docker Compose, which you will need for the production PostgreSQL setup later. The visual interface also makes managing containers, volumes, and networks much easier if you are new to Docker.
Install Docker Desktop on macOS
- Visit Docker.com and click Download Docker Desktop.
- Select Apple Silicon if you have an M1, M2, or M3 Mac. Select Intel if you have an older Mac.
- Open the downloaded .dmg file.
- Drag the Docker icon to your Applications folder.
- Open Docker Desktop from your Applications folder.
- Grant system permissions when macOS prompts you. If you see a permission denied error, open System Settings, then Privacy & Security, then Full Disk Access, and add Docker.
- Wait for the Docker engine to start. You will see a whale icon appear in your menu bar.
- Open Terminal and run docker –version to verify installation. You should see output like Docker version 27.x.x.
- Run docker compose version to confirm Docker Compose is installed. You should see Docker Compose version v2.x.x.
Install Docker Desktop on Windows
- Download Docker Desktop for Windows from Docker.com. Select the AMD64 version.
- Run the installer executable.
- Follow the installation wizard, accepting all defaults.
- When prompted, allow Docker to install WSL 2 (Windows Subsystem for Linux) components. If you see a “WSL 2 not installed” error, visit Microsoft’s official WSL 2 setup guide and install it manually before continuing.
- Restart your computer when the installation completes.
- Open Docker Desktop from the Start menu.
- Accept the service agreement and complete the initial setup.
- Open Command Prompt or PowerShell and run docker –version to verify installation.
- Run docker compose version to verify Docker Compose is installed.

Install Docker on Linux
- Choose between Docker Desktop (GUI) or CLI-only installation. For solopreneurs who prefer visual management, Docker Desktop is recommended.
- For Docker Desktop, download the .deb package (Debian or Ubuntu) or .rpm package (Fedora or RHEL) from Docker.com.
- Install with your package manager. For Debian or Ubuntu: sudo apt install ./docker-desktop-<version>.deb. For Fedora or RHEL: sudo dnf install ./docker-desktop-<version>.rpm.
- For CLI-only installation, follow Docker’s official installation script for your specific distribution.
- Add your user to the Docker group: sudo usermod -aG docker $USER.
- Log out and log back in for the group changes to take effect.
- Start the Docker service: sudo systemctl start docker.
- Verify installation with docker –version and docker compose version.
If you see “docker: command not found” on Linux, the Docker service is likely not running. Check its status with sudo systemctl status docker and start it if needed.
Start n8n Docker in 2 Minutes with One Command (Local Setup)
This is the fastest way to get n8n Docker running on your machine. The single-command approach uses SQLite as the database (no separate database server needed) and is perfect for testing, learning the interface, and running light workflows with fewer than 10 executions per day. If you have already gone through the basics in my guide to installing n8n locally, this Docker method gives you a cleaner, more portable setup.
Step 1: Create Persistent Storage Volume
Open your terminal (Terminal on macOS and Linux, Command Prompt or PowerShell on Windows) and run:
docker volume create n8n_data
This creates a named volume where n8n stores all your workflows, credentials, and execution history. This is the single most important step in the entire setup. Skip it and you lose everything when the container restarts.
Step 2: Run the n8n Container
Copy and paste this entire command into your terminal:
docker run -d –name n8n -p 5678:5678 -e GENERIC_TIMEZONE=”America/New_York” -e TZ=”America/New_York” -e N8N_RUNNERS_ENABLED=true -v n8n_data:/home/node/.n8n n8nio/n8n
Here is what each part does:
- -d — Runs the container in the background (detached mode) so you can close the terminal without stopping n8n.
- –name n8n — Names the container “n8n” so you can reference it easily in future commands.
- -p 5678:5678 — Maps port 5678 from the container to your computer. This is how you access n8n in your browser.
- -e GENERIC_TIMEZONE=”America/New_York” — Sets the timezone for workflow execution. Replace with your timezone.
- -e TZ=”America/New_York” — Sets the container’s system timezone to match.
- -e N8N_RUNNERS_ENABLED=true — Enables the workflow execution engine.
- -v n8n_data:/home/node/.n8n — Mounts the persistent volume you created to n8n’s data directory.
- n8nio/n8n — The official n8n Docker image from Docker Hub.
Without timezone configuration, all workflows run in UTC. If you schedule a task for 9am, it triggers at 9am UTC, which could be 1am or 4am your local time. Always set GENERIC_TIMEZONE to your actual timezone.
Common timezone values: America/New_York (US Eastern), America/Los_Angeles (US Pacific), America/Chicago (US Central), Europe/London (UK), Europe/Paris (Central Europe), Asia/Tokyo (Japan), Australia/Sydney (Australia).
Step 3: Verify n8n Docker Is Running
- Wait 30 seconds for the container to fully start.
- Run docker ps in your terminal. You should see a container named n8n with status Up and port 5678 exposed.
- Open your web browser and navigate to http://localhost:5678.
- You should see the n8n welcome screen prompting you to create an account.
If you see a blank page or connection error, run docker logs n8n to check for error messages. The most common issue is port 5678 already being used by another application. Change the port mapping to -p 5679:5678 and access n8n at http://localhost:5679 instead.
Set Up Production-Ready n8n Docker with PostgreSQL Database
The single-command setup works for testing, but production workflows need PostgreSQL. Why? SQLite locks the entire database during writes, which causes failures when multiple workflows execute simultaneously. PostgreSQL handles concurrent connections, survives container updates without data loss, and scales as your workflow count grows. This is the setup I recommend for any solopreneur or small team planning to rely on n8n Docker for daily business operations.
Step 1: Generate Your Encryption Key
Run this command in your terminal:
openssl rand -hex 24
This outputs a 48-character string. Copy it immediately. This key encrypts every credential you store in n8n, including API keys, OAuth tokens, and passwords. If you lose this key, every stored credential becomes permanently unrecoverable. There is no reset, no recovery, no workaround.
Step 2: Create Your .env File
Create a new directory for your n8n project, then create a file named .env inside it with the following contents:
POSTGRES_USER=n8n
POSTGRES_PASSWORD=your-secure-postgres-password-16-characters-minimum
POSTGRES_DB=n8n
N8N_ENCRYPTION_KEY=paste-your-generated-48-character-key-here
N8N_HOST=localhost
N8N_PORT=5678
N8N_PROTOCOL=http
GENERIC_TIMEZONE=America/New_York
TZ=America/New_York
DB_TYPE=postgresdb
DB_POSTGRESDB_HOST=n8n-postgres
DB_POSTGRESDB_PORT=5432
DB_POSTGRESDB_DATABASE=n8n
DB_POSTGRESDB_USER=n8n
DB_POSTGRESDB_PASSWORD=your-secure-postgres-password-16-characters-minimum
Replace the password values with a strong, unique password of at least 16 characters. Replace the encryption key with the one you generated in Step 1. Replace the timezone with your actual timezone.
Step 3: Create Your docker-compose.yml File
In the same directory as your .env file, create a file named docker-compose.yml with the following contents:
version: ‘3.8’
services:
n8n-postgres:
image: postgres:16
container_name: n8n-postgres
restart: unless-stopped
environment:
– POSTGRES_USER=${POSTGRES_USER}
– POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
– POSTGRES_DB=${POSTGRES_DB}
volumes:
– postgres_data:/var/lib/postgresql/data
healthcheck:
test: [‘CMD-SHELL’, ‘pg_isready -U ${POSTGRES_USER}’]
interval: 10s
timeout: 5s
retries: 5
n8n:
image: n8nio/n8n
container_name: n8n
restart: unless-stopped
ports:
– ‘5678:5678’
environment:
– DB_TYPE=${DB_TYPE}
– DB_POSTGRESDB_HOST=${DB_POSTGRESDB_HOST}
– DB_POSTGRESDB_PORT=${DB_POSTGRESDB_PORT}
– DB_POSTGRESDB_DATABASE=${DB_POSTGRESDB_DATABASE}
– DB_POSTGRESDB_USER=${DB_POSTGRESDB_USER}
– DB_POSTGRESDB_PASSWORD=${DB_POSTGRESDB_PASSWORD}
– N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
– N8N_HOST=${N8N_HOST}
– N8N_PORT=${N8N_PORT}
– N8N_PROTOCOL=${N8N_PROTOCOL}
– GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
– TZ=${TZ}
volumes:
– n8n_data:/home/node/.n8n
depends_on:
n8n-postgres:
condition: service_healthy
volumes:
postgres_data:
n8n_data:
Key elements in this configuration: the healthcheck on PostgreSQL ensures n8n does not start until the database is ready. The restart: unless-stopped policy automatically restarts containers after crashes or server reboots. The depends_on with condition: service_healthy prevents n8n from throwing database connection errors on startup.
Step 4: Start Your n8n Docker Services
- Open your terminal and navigate to the directory containing your docker-compose.yml and .env files.
- Run docker compose up -d to start both services in the background.
- Run docker compose ps to verify both n8n-postgres and n8n show status Up and healthy.
- Run docker compose logs n8n to check for success messages. Look for “n8n ready” and “database initialized” in the output.
- Open your browser and navigate to http://localhost:5678. You should see the n8n welcome screen.

Optional: Add Redis for Queue Mode (20+ Workflows)
If you are running 20 or more active workflows, a single n8n container will struggle with concurrent executions. Queue mode with Redis distributes the load across multiple worker containers. Add these services to your docker-compose.yml:
Add a redis service with image redis:7-alpine, container name n8n-redis, restart policy unless-stopped, and a volume redis_data:/data. Then add an n8n-worker service using the same n8nio/n8n image with environment variables EXECUTIONS_MODE=queue, QUEUE_BULL_REDIS_HOST=redis, and QUEUE_BULL_REDIS_PORT=6379, plus all the same database and encryption variables from the main n8n service. Add EXECUTIONS_MODE=queue and the Redis variables to your main n8n service environment as well. Add redis_data: to your volumes section.
You can scale workers by duplicating the worker service definition (n8n-worker-2, n8n-worker-3) for 2 to 4 total workers, which smooths CPU spikes and handles 40 to 200+ parallel executions depending on workflow complexity.
Add Memory and CPU Limits
To prevent one runaway workflow from consuming all system memory and crashing everything, add resource limits to your n8n service in docker-compose.yml. Under the n8n service, add a deploy section with resources, setting limits to cpus: ‘2’ and memory: 4G, and reservations to cpus: ‘1’ and memory: 2G. This guarantees n8n always has 2GB available while capping it at 4GB maximum.
Create Your First Account and Secure Your n8n Docker Credentials
With n8n running, you need to create your owner account, back up your encryption key, and configure credential storage. Security is not optional here. Your n8n instance will store API keys, OAuth tokens, and passwords for every service you connect. One misconfiguration can expose all of them.
Step 1: Create Your Owner Account
- Open your browser and navigate to http://localhost:5678.
- You will see the “Welcome to n8n” screen.
- Click Create Account.
- Enter your email address. Use a real email you can access for password recovery.
- Create a password with at least 16 characters using a mix of uppercase, lowercase, numbers, and symbols. Example format: Tr0p!cal-Sunr!se-2026-n8n.
- Click Continue or Create Account.
- n8n logs you in automatically and shows the workflow canvas.
Step 2: Back Up Your Encryption Key
If you set up the production Docker Compose configuration, your encryption key is already in your .env file. Now back it up separately:
- Copy the 48-character N8N_ENCRYPTION_KEY value from your .env file.
- Store it in a password manager like 1Password, Bitwarden, or LastPass.
- Alternatively, save it to a USB drive and store it in a safe location.
- Never store the encryption key in the same location as your Docker files.
- Never commit your .env file to version control. Add .env to your .gitignore file immediately.
Step 3: Add Your First Credential
- Click your profile icon in the top right corner of the n8n interface.
- Select Settings from the dropdown menu.
- Click Credentials in the left sidebar.
- Click the Add Credential button.
- Search for the service you want to connect, such as “Google” or “Gmail.”
- Select Google OAuth2 API.
- Click Connect my account.
- A Google login window opens. Sign in with your Google account.
- Grant n8n the requested permissions.
- You are redirected back to n8n with a green checkmark confirming the credential is saved.
Step 4: Configure a Public URL for Webhooks
Your local n8n Docker instance has no public URL. External services like Stripe, GitHub, or Slack cannot send webhook data to http://localhost:5678. You need a tunneling solution.
Option A: Ngrok (Quick Testing)
- Install Ngrok from ngrok.com.
- Run ngrok http 5678 in a new terminal window.
- Ngrok displays a forwarding URL like https://abc123def456.ngrok.io.
- Add these lines to your .env file: N8N_HOST=abc123def456.ngrok.io and WEBHOOK_TUNNEL_URL=https://abc123def456.ngrok.io.
- Restart your n8n container with docker compose restart n8n.
- Note: The free Ngrok tier changes your URL every 8 hours. This is fine for testing but not for production webhooks.
Option B: Railway (Production) — Deploy n8n to Railway.app for a permanent domain. This is covered in detail in my n8n self-hosted setup guide.
Option C: Cloudflare Tunnels (Free, Requires Domain) — The most reliable option if you own a domain. Requires Cloudflare DNS but provides a permanent, free tunnel with SSL.
Security Checklist for Solopreneurs
- Password — 16+ characters with mixed case, numbers, and symbols.
- Encryption key — Backed up separately from Docker files.
- .env file — Added to .gitignore, never committed to version control.
- PostgreSQL password — Different from your n8n account password.
- Webhook authentication — Enabled on any webhook exposed to the internet (covered in the workflow section below).
You do not need SSO, LDAP, hardware 2FA tokens, or IP whitelist firewalls as a solopreneur. A strong password stored in a password manager plus a backed-up encryption key is sufficient security for most small operations.
Build Your First n8n Docker Workflow in 10 Minutes
With n8n running and your account created, it is time to build something useful. This example creates a daily GitHub activity summary that posts to Slack automatically. It demonstrates the core concepts you will use in every workflow: triggers, HTTP requests, data transformation, and output to a messaging platform. For more workflow ideas and patterns, check out my n8n workflow automation guide.
Step 1: Create a New Workflow
- Click Workflows in the left sidebar.
- Click the + Add Workflow button.
- Name it something descriptive like “Daily GitHub Summary – 2026-03.”
- Click Save in the top right corner.
Step 2: Add a Schedule Trigger
- Click Add first step in the center of the canvas.
- In the search box, type Schedule.
- Click Schedule Trigger.
- Set Trigger Interval to Days.
- Set Days Between Triggers to 1.
- Set Trigger at Hour to 9.
- Set Trigger at Minute to 0.
- Verify the Timezone field shows your correct timezone (for example, America/New_York).
- Click Execute Step to test. The Output panel should show “This node executed successfully” with a timestamp matching your timezone.
Step 3: Add an HTTP Request Node to Fetch GitHub Data
- Click the + button on the right side of the Schedule Trigger node.
- Search for HTTP Request and click it.
- Set Method to GET.
- Set URL to https://api.github.com/users/YOUR-USERNAME/events, replacing YOUR-USERNAME with your actual GitHub username.
- Leave Authentication set to None (works for public repositories).
- Set Response Format to JSON.
- Click Execute Step. The Output panel displays an array of GitHub events with commit data, timestamps, and repository names.
Step 4: Filter for Today’s Activity
- Click the + button after the HTTP Request node.
- Search for Filter and click it.
- Set the condition type to Date & Time.
- Set Field to {{ $json.created_at }}.
- Set Operation to After or Equal.
- Set Value to {{ $now.startOf(‘day’).toISO() }}.
- Click Execute Step. The Output panel shows only events from today.
Step 5: Format the Data with a Code Node
- Click the + button after the Filter node.
- Search for Code and click it.
- Paste this JavaScript into the code editor:
const commits = $input.all();
const count = commits.length;
const summary = commits.map(c =>
`• ${c.json.repo.name}: ${c.json.payload.commits?.[0]?.message || ‘Activity’}`
).join(‘\n’);
return [{ json: { text: `📊 Daily GitHub Activity\n\n${count} events today:\n${summary}` } }];
- Click Execute Step. The Output panel shows a formatted message with your GitHub activity summary.
Step 6: Send the Summary to Slack
- Click the + button after the Code node.
- Search for Slack and click it.
- If this is your first time using Slack in n8n, click Create New Credential, select OAuth2, click Connect my account, and authorize n8n in Slack.
- Set Resource to Message.
- Set Operation to Post.
- Select your target channel (for example, #general).
- Set Text to {{ $json.text }}.
- Click Execute Step. Check your Slack channel. The formatted GitHub summary should appear.
Step 7: Activate the Workflow
- Click the Inactive toggle at the top of the canvas.
- The toggle switches to Active (green).
- Your workflow now runs automatically at 9am daily in your configured timezone.
This example workflow saves approximately 15 minutes daily of manually checking GitHub, summarizing activity, and posting to Slack. Over 250 workdays, that is 62.5 hours per year saved from a workflow that took 10 minutes to build.
Common Beginner Mistakes to Avoid
- Wrong timezone — Your workflow is set to 9am but triggers at 2am. Fix: Open the Schedule Trigger node and verify the Timezone field matches your actual location.
- Skipping Execute Step — You build the entire workflow, click Activate, and nothing happens. Fix: Test each node individually with Execute Step before moving to the next one.
- Not checking data flow — Nodes are connected but no data reaches the final node. Fix: After testing each node, open the Output tab and verify the data structure matches what the next node expects.
- Wrong field names — You use {{ $json.email }} but the output is blank. Fix: Click the previous node, open the Output tab, expand the JSON, and find the actual field name. It might be {{ $json.user.email }} or {{ $json.contact_email }}.
Your first workflow will take 20 to 30 minutes including learning the interface. By your fifth workflow, you will be building simple automations in 5 to 10 minutes. The n8n community template library has over 6,700 free workflow templates you can import and customize instead of building from scratch.
Troubleshoot Common n8n Docker Installation and Configuration Problems
Even with perfect instructions, things go wrong. Here is a comprehensive reference for every common error you will encounter when running n8n Docker, organized by exact error message so you can find your fix fast.
Error: JavaScript Heap Out of Memory
Root cause: Node.js default memory limit is too low for workflows handling large datasets.
Fix: Add -e NODE_OPTIONS=–max-old-space-size=2048 to your docker run command. For Docker Compose, add NODE_OPTIONS=–max-old-space-size=2048 to the n8n service environment variables. Then restart the container with docker compose restart n8n.
Error: Cannot Connect to Database
Root cause: PostgreSQL is not running, or the connection credentials are wrong.
Fix: Run docker ps to verify the postgres container is running. Check that DB_POSTGRESDB_HOST in your .env file matches the exact container name (for example, n8n-postgres). Verify the password in DB_POSTGRESDB_PASSWORD matches POSTGRES_PASSWORD exactly. Run docker compose logs n8n-postgres to check for database startup errors.
Error: Workflows Lost After Reboot
Root cause: No persistent volume or the volume mount path is misconfigured.
Fix: Run docker volume ls to list all volumes. Verify your docker-compose.yml shows n8n_data:/home/node/.n8n under the n8n service volumes. If the volume is missing, create it with docker volume create n8n_data and restart. This is the number one cause of data loss in n8n Docker installations, as documented in the official n8n Docker documentation.
Error: Permission Denied for /home/node/.n8n
Root cause: Docker volume directories have wrong file ownership. n8n runs as uid 1000.
Fix: Run docker exec n8n ls -la /home/node/.n8n to check ownership. If the owner is not uid 1000, run sudo chown -R 1000:1000 ./n8n_data on the host machine, then restart the container.
Error: Wrong Username or Password (After Update)
Root cause: The encryption key changed or was not explicitly set. When n8n starts without a specified encryption key, it generates a new one, making all previously saved credentials unreadable.
Fix: Stop the container. Add N8N_ENCRYPTION_KEY=your-backed-up-key to your .env file using the key you backed up earlier. Restart the container. If you never backed up the key, the credentials are permanently lost and must be re-created.
Error: Webhook Returns 404 Not Found
Root cause: The webhook URL is incorrect or the workflow is not activated.
Fix: Copy the webhook URL directly from the Webhook node in n8n. Test it with: curl -X POST https://your-domain/webhook/test-webhook -H “Content-Type: application/json” -d ‘{“test”: “data”}’. If you get a 404, check that the workflow toggle is set to Active (green). An inactive workflow does not register its webhook endpoints.
Error: Webhook Received but Workflow Does Not Run
Root cause: The WEBHOOK_TUNNEL_URL environment variable is not set or does not match your public domain.
Fix: Check the current value with docker exec n8n printenv WEBHOOK_TUNNEL_URL. The output must match your actual public domain exactly (for example, https://your-app.railway.app). If it shows http://localhost:5678 or is empty, update your .env file and restart the container with docker compose restart n8n.
Error: Database Disk Full
Root cause: Execution logs from successful workflow runs are filling PostgreSQL storage.
Fix: In the n8n interface, go to Settings, then Executions, and set Save Successful Executions to off. This stops logging every successful run while still keeping failed execution records for debugging. For high-volume workflows running 100+ times per day, this prevents PostgreSQL from growing 5 to 10GB per month.
Debugging OAuth Token Expiration
If a workflow worked for 7 to 30 days and then starts failing with 401 errors, the OAuth refresh token has expired.
- Go to Settings, then Credentials.
- Find the failing credential. It will show a red exclamation mark.
- Click the credential name.
- Click Renew or Reconnect.
- Re-authenticate with the service.
- Return to your workflow and click Execute Step on the affected node to verify it works.
Debugging API Rate Limiting (429 Errors)
If your workflow calls an API 100 times in one minute and hits a rate limit, add a Wait node after the API call. Set Amount to 1 and Unit to seconds. Each request now pauses one second before the next. Alternatively, use bulk API endpoints to send 100 items in a single request instead of 100 separate requests.
When you have spent 30 or more minutes on an issue not covered here, post in the n8n Community Forum with your exact error message and a screenshot of your workflow. The community is active and responsive.

Scale Your n8n Docker Setup from 1 to 50+ Workflows
A single n8n container handles 5 to 15 concurrent workflows smoothly on 4GB RAM. Beyond that, execution queues build up and workflows start failing with timeout errors. Here is how to scale as your automation needs grow:
- 1–3 workflows — Use the single Docker command setup or Railway free tier. Total cost: $0–$10 per month. No Redis needed.
- 5–15 workflows — Use Docker Compose with PostgreSQL (the production setup from this guide) or n8n Cloud Starter at $20 per month. Total cost: $10–$20 per month.
- 20–50 workflows — Add Redis queue mode with 2 worker containers. Allocate 8GB+ RAM. Total cost: $50–$100 per month for hosting.
- 50+ workflows — Full queue mode with 4 workers, dedicated PostgreSQL server, monitoring alerts. Total cost: $150–$400 per month.
A critical scaling habit: name your workflows with a date and purpose, like “2026-03-contact-sync-hubspot.” After six months of building automations, you will have dozens of workflows. Without descriptive names, you end up with “Workflow 1” through “Workflow 47” and no idea which ones are still needed.
Disable saving successful executions for any workflow running more than 100 times per day. Go to Settings, then Executions, and toggle Save Successful Executions to off. Keep failed execution logging enabled for debugging. This single change prevents your PostgreSQL database from growing several gigabytes per month.
n8n Docker Cost Comparison for Solopreneurs and Small Teams
Understanding the true cost of each option helps you make the right choice for your budget and technical comfort level:
- n8n Cloud Starter ($20 per month) — 2,500 executions included. No infrastructure to manage. Includes AI Assistant. Best for freelancers with 5–10 workflows who do not know Docker or do not want to manage servers.
- Self-hosted on Railway ($5–$20 per month) — Cheapest reliable option. Includes domain and PostgreSQL. Five-minute setup with their n8n template. Best for technically comfortable solopreneurs on tight budgets.
- Self-hosted on Hetzner ($4 per month) — ARM64 CAX11 server. Requires full Docker setup. Most affordable for long-term production use. Best for technical users comfortable with Linux server administration.
- Make.com ($10–$29 per month) — Easiest visual interface. Best for non-technical users with simple 3–5 step workflows. But a 10-step workflow costs 10 operations per run, making it 2–3 times more expensive than n8n at scale.
- Zapier ($30+ per month) — Largest integration library with 8,000+ apps. Most beginner-friendly. But most expensive for anything beyond simple automations due to per-task billing.
Here is a real example: a small marketing agency with 3 employees and 15 active workflows would pay $720 per year on n8n Cloud Pro ($60 per month), $1,800+ per year on Zapier equivalent ($150+ per month), or $180 per year self-hosted on Railway ($15 per month). The self-hosted option is cheapest on paper, but if you are a non-technical solopreneur spending 20 hours troubleshooting Docker issues at $50–$100 per hour, you have spent $1,000–$2,000 in labor. That makes “free” self-hosting actually more expensive than n8n Cloud’s $240 per year.
Maintain and Back Up Your n8n Docker Installation
Running n8n Docker in production requires regular maintenance. Without it, you will eventually face data loss, failed workflows, or security vulnerabilities. Here is the maintenance routine I recommend for solopreneurs and small teams:
Set Up Automated Database Backups
- Create a backup script file. Name it backup-n8n.sh and add these commands: docker exec n8n-postgres pg_dump -U n8n n8n > /backup/n8n-db-$(date +%Y%m%d).sql followed by docker run –rm -v n8n_data:/source -v /backup:/dest alpine tar czf /dest/n8n-data-$(date +%Y%m%d).tar.gz -C /source .
- Make the script executable: chmod +x backup-n8n.sh.
- Schedule it to run daily at 2am: run crontab -e and add the line 0 2 * * * /home/user/backup-n8n.sh.
- Verify the cron job is saved: crontab -l.
- Test the backup script manually by running ./backup-n8n.sh and checking that backup files appear in your /backup directory.
Update n8n Docker Images Monthly
- Check for updates: docker pull n8nio/n8n.
- Before updating, tag your current image as a backup: docker tag n8nio/n8n:latest n8nio/n8n:backup-$(date +%Y%m%d).
- Run a full database backup using the script above.
- Stop and restart your services: docker compose down followed by docker compose up -d.
- Verify everything works: docker compose ps should show all services as Up and healthy.
- Test your most critical workflows by clicking Execute Step on each node.
- If something breaks, roll back: docker compose down, then edit docker-compose.yml to use n8nio/n8n:backup-YYYYMMDD instead of n8nio/n8n, then docker compose up -d.
Export Workflows as JSON for Version Control
- In the n8n interface, open each workflow you want to back up.
- Click the three-dot menu in the top right corner.
- Select Download to export the workflow as a JSON file.
- Save these JSON files in a Git repository for version history.
- Do this monthly or after any significant workflow changes.
- To restore a workflow, click Add Workflow, then Import from File, and select the JSON file.
Production Deployment Checklist for n8n Docker
Before relying on your n8n Docker setup for daily business operations, run through this checklist. Print it out or save it. Each item includes the estimated time to complete:
- Back up encryption key (5 minutes) — Store in password manager, separate from Docker files.
- Configure WEBHOOK_TUNNEL_URL (2 minutes) — Verify with a curl test to your public domain.
- Enable webhook authentication (3 minutes) — Add Header Auth to every webhook node exposed to the internet.
- Create owner account with strong password (2 minutes) — 16+ characters, mixed case, numbers, symbols.
- Test all workflows with real data (30 minutes) — Run each workflow manually and verify output matches expectations.
- Set up error notifications (5 minutes) — Create a Global Error Trigger workflow that sends Slack or email alerts when any workflow fails.
- Configure automated database backups (10 minutes) — Create and schedule the backup cron job.
- Verify HTTPS and SSL work (5 minutes) — Browse to your public URL and confirm the green lock icon appears.
- Add .env to .gitignore (1 minute) — Prevent accidental exposure of secrets in version control.
- Document each workflow (30 minutes) — For every workflow, write its purpose, trigger type, actions, failure modes, and manual workaround.
Here is a workflow documentation template you can copy: Workflow Name: Daily Sales Report. Owner: Your name. Trigger: Schedule, 8am daily. Actions: (1) Salesforce API query for new deals, (2) Calculate KPIs in Code node, (3) Send summary to Slack channel. Failure mode: If Salesforce API is down, workflow fails silently. Manual workaround: Log into Salesforce, export deals, email summary to team. Last updated: Current date.
Start Automating with n8n Docker Today
You now have everything you need to install, configure, and run n8n Docker for real production use. From checking your system requirements and installing Docker Desktop, through the quick single-command setup and the production-ready PostgreSQL configuration, to building your first workflow and troubleshooting every common error, this guide covers the complete journey.
The key decisions to remember: use the single Docker command for testing and learning, switch to Docker Compose with PostgreSQL for anything you rely on daily, always back up your encryption key separately, and set your timezone before activating any scheduled workflow. If you are a solopreneur who values time over tinkering, Railway at $5–$10 per month or n8n Cloud at $20 per month will get you running faster than local Docker.
The automation you build today saves you hours every week going forward. Start with one simple workflow, like the GitHub summary example above, get comfortable with the interface, and then expand from there. The n8n template library has over 6,700 free workflows you can import and customize for your specific needs.
What has your experience been with running n8n in Docker? Have you hit any issues not covered here, or found a setup that works particularly well for your business? Share your thoughts in the comments below!
