I’m looking for an example docker compose to self-host the community version of n8n.
I initially went through the documentation and the compose example seemed to be outdated as I got a few errors. However now, the docs seems to be updated and there is no longer a compose example.
Can someone share the recommended setup?
@newdimension Yes, the link @moosa posted is the correct file. The docs replaced the inline YAML with a GitHub-file embed on September 3, but that embed is currently not rendering in Step 4, so it looks like the example was removed.
For the editable default stack, use:
That includes persistent n8n storage and the Assistant sandbox, with SQLite as the default database.
If this will be a production setup and you want PostgreSQL plus an external task runner, start with this official example instead:
Both run as Community edition unless you add a licence key. You would still add your own domain and reverse proxy in front.
Here’s a minimal but production-ready docker-compose.yml for n8n self-hosting (community edition, with SQLite for simplicity — swap to Postgres if you need scale):\n\nyaml\nversion: '3.8'\nservices:\n n8n:\n image: docker.n8n.io/n8nio/n8n\n restart: always\n ports:\n - '5678:5678'\n environment:\n - N8N_HOST=your-domain.com\n - N8N_PORT=5678\n - N8N_PROTOCOL=https\n - WEBHOOK_URL=https://your-domain.com/\n - GENERIC_TIMEZONE=America/New_York\n - N8N_ENCRYPTION_KEY=your-random-32-char-key\n volumes:\n - n8n_data:/home/node/.n8n\nvolumes:\n n8n_data:\n\n\nKey things that trip people up:\n- N8N_HOST must match the domain you’re accessing it from\n- WEBHOOK_URL must end with a trailing slash\n- N8N_ENCRYPTION_KEY is required in newer versions — generate one with openssl rand -hex 16\n\nIf you need Postgres instead of SQLite, add DB_TYPE=postgresdb and the Postgres connection vars. Happy to share a full Postgres + Traefik example if you need it.