Contra - A professional network for the jobs and skills of the futureSafely Updating n8n in Docker Without Losing Data
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
How to update n8n in Docker without losing data, and what to do before you pull the new image.
The update itself is short. With Docker Compose: pull the new image, then recreate the container (docker compose pull, then docker compose up -d). Your workflows only survive if the data sits outside the container. Here is what my self-hosted template does, checked against the n8n docs:
Before the update
• Check where the data lives. The n8n_data volume must be mounted on /home/node/.n8n. Even with PostgreSQL, that folder still holds the encryption key. No volume means the new container starts empty.
• Back up the database and the encryption key. Migrations run when the new version starts. If one can't be reverted, the backup is the only way back.
• Pin the version. My .env says N8N_VERSION=2.41.6, never latest, because latest can jump a major version on a routine pull.
• Read the release notes between your version and the target. The docs advise updating at least once a month, so you never jump many versions at once.
If it goes wrong
• n8n db:revert undoes one migration per run, and it has to be run with the newer version.
• If that fails, restore the backup and go back to the old tag.
One more trap: after the update the n8n container gets a new IP, and a reverse proxy that cached the old one answers 502. Mine resolves the container on every request.
How do you update n8n today: pinned version, or latest and hope?
Post image
Michael's avatar
Pinning is the habit most self-hosted setups skip. One thing I add before every update: export all workflows to files next to the database backup, so even if a restore goes wrong you can rebuild on a clean instance fast. Do you test the new version on a copy first, or straight on the live one?
Zakaria's avatar
Good add, Michael. Workflow files next to the dump give you a second way back. On a copy first: the template has a restore drill file for that. It brings last night's backup up on a scratch machine where n8n has no internet access, because a restored n8n comes back with its...
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started