How to Self-Host n8n with Docker Compose (And When You Shouldn’t)

Looking to run your own automations without paying a monthly fee? n8n is a powerful, open-source workflow automation tool that lets you build complex integrations without code. And with Docker Compose, you can self-host it on your own server in just a few minutes. But before you dive in—there are a few important trade-offs to know. In this guide, you’ll get a complete walkthrough of how to set up n8n with Docker Compose, plus a clear look at when going with their paid cloud plan might actually be smarter.


What is n8n?
n8n (short for “nodemation”) is an open-source platform for creating automated workflows. Think Zapier, but self-hostable and much more customizable. You can connect APIs, databases, CRMs, spreadsheets, and just about anything else into drag-and-drop workflows that run on triggers or schedules.

There are two main ways to use n8n:

  • Self-hosted (free): You install it on your own server using Docker, Node.js, or similar

  • Cloud (paid): n8n hosts it for you, with support and premium features


Why Use Docker Compose to Host n8n?
Self-hosting with Docker Compose is ideal if you:

  • Want full control over data and infrastructure

  • Need a free solution for your team or project

  • Love to tinker and optimize

Docker Compose allows you to define and manage your whole stack in one simple file. It’s quick, lightweight, and lets you persist workflows, store credentials, and restart containers automatically.

Don’t Just Read About It — Launch Your Own AI Workflow with n8n (No Cost)


Quickstart: Deploy n8n with Docker Compose
Here’s a working example you can copy and use:

yaml
version: "3.1"
services:
n8n:
image: n8nio/n8n
restart: always
ports:
- "5678:5678"
environment:
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=securepassword
- N8N_HOST=localhost
- N8N_PORT=5678
- TZ=America/New_York
volumes:
- ./n8n-data:/home/node/.n8n

Run it with:

bash
docker-compose up -d

Visit http://localhost:5678 and log in with your basic auth credentials. Your workflows will be saved to the ./n8n-data folder.


Common Pitfalls & Troubleshooting Tips

  • n8n not loading? Make sure port 5678 is open and the container is running.

  • Workflows not saving? Check that your volume is mounted and has the right permissions.

  • Webhook not triggering? Make sure your firewall or reverse proxy allows external traffic to that port.

  • Need SSL? Set up a reverse proxy with Nginx and Let’s Encrypt.

Unlock Your First Automation — Try n8n Free and Build Smarter, Faster


Self-Hosting Limitations vs Paid Plan

Feature Docker Compose (Free) n8n Cloud (Paid)
Setup Time Manual Instant
Maintenance Your responsibility Automatic
Authentication Basic only OAuth, LDAP, SAML
Scaling DIY Built-in
Support Forums/Docs Email/Chat (Pro)
Features Core only Premium integrations

When to Consider the Paid Plan Instead
While Docker is great for devs, it may not be ideal if:

  • Your business requires compliance or uptime guarantees

  • You don’t want to deal with server maintenance

  • You need enterprise features like user access control or team collaboration

In those cases, the n8n Cloud plans may save you time, stress, and even money in the long run.


Conclusion
Running n8n with Docker Compose is a powerful way to keep full control and save money. But like any DIY setup, it comes with trade-offs. If you’re just experimenting or building personal projects, it’s a no-brainer. But if you’re scaling, working with clients, or need a more robust solution—don’t rule out the paid version. Either way, start with the free Dev Stack Starter Guide and build your workflow the right way.

Download Your FREE

Dev Stack Starter Guide

Build, automate, and launch faster—see the automation stack developers and agencies are switching to.

  • ✅ API Templates & Code Snippets
  • ✅ Done-for-You Automation Workflows
  • ✅ Step-by-Step Funnel & CRM Guide
  • ✅ Free for Developers, Freelancers, & SaaS Builders











We Respect Your Privacy