Running a self-hosted n8n instance gives you full control over your automation workflows, but keeping it updated is essential for new features, bug fixes, and security patches. If your n8n is installed via Docker Compose (the recommended production setup with PostgreSQL), updating is straightforward and safe. Your workflows, credentials, and data stay intact.
In this guide from SFWEB, we'll walk you through the exact process we use for clients: backing up, pulling the latest stable image, and restarting with zero downtime risk. This method follows the official n8n documentation and works perfectly in 2026.
Why Update Your Self-Hosted n8n Regularly?
- Access the newest nodes, AI integrations, and performance improvements
- Fix bugs and patch security vulnerabilities
- Avoid large version jumps that could cause breaking changes
- Stay compatible with the latest n8n release channels (
:stableis production-recommended)
Pro tip: Check the official n8n release notes before updating to spot any breaking changes.
Prerequisites
- Access to your Ubuntu server (or any Linux host) via SSH
- Docker and Docker Compose installed
- n8n running with Docker Compose + PostgreSQL (common setup)
- A directory containing your
docker-compose.ymlfile (often~/n8n)
Step-by-Step: How to Update n8n Docker Compose Safely
- Navigate to Your n8n Docker Compose Directory
This is where yourdocker-compose.ymllives.cd ~/n8n ls # You should see docker-compose.yml - Backup Your n8n Database (Highly Recommended)
Export your PostgreSQL database to prevent data loss.docker compose exec n8n_db pg_dump -U postgres n8n > n8n_backup_$(date +%F).sqlIf the service isn't running or you get an error, start it first or adjust the user (-U flag) based on your compose file.
- Pull the Latest n8n Stable Image
This downloads the newest:stableversion without downtime yet.docker compose pullYou'll see layers downloading for both
n8nandpostgresservices if needed. - Stop and Remove the Current Containers
This recreates them with the new image while preserving volumes (data stays safe).docker compose downNote: You may see a warning about the obsolete
version:attribute in your compose file, it's safe to ignore or remove it from the YAML for cleanliness. - Start n8n with the Updated Image
Bring everything back up in detached mode.docker compose up -d - Verify the Update
Check running containers and logs.docker compose ps # Expected: n8n_app (or n8n) and n8n_db (or db) both "Up" docker compose logs -f n8n # Look for: new version number in startup banner, successful DB connection, "n8n ready on 0.0.0.0, port 5678"Open your browser at http://your-server-ip:5678 (or your domain). All workflows, credentials, and executions should be unchanged.
Quick One-Liner Update Command
Once in the correct directory:
docker compose pull && docker compose down && docker compose up -d
Common Issues and Fixes
- Warning about 'version' attribute obsolete: Remove the
version: 'x.x'line from docker-compose.yml. Modern Compose ignores it. - n8n still on old version?: Ensure your compose file uses
image: n8nio/n8n:stable(not a pinned old tag like :1.50.0). Then usedocker compose up -d --force-recreateif needed. - Database connection error after update: Double-check env vars in compose file (DB_TYPE=postgresdb, DB_POSTGRESDB_HOST=n8n_db or db, etc.).
Best Practices for n8n Docker Management
- Use
:stabletag for production reliability - Backup regularly (database + .n8n folder if mounted)
- Test major updates in a staging environment first
- Consider SFWEB's managed hosting if self-managing becomes time-consuming
Updating n8n doesn't have to be complicated. Follow these steps, and your automation workflows stay cutting-edge. Questions or need help with your setup? Contact SFWEB our team specializes in n8n deployments, custom integrations, and secure self-hosting.