Hello! Totally newbie in n8n, but I would like to use it in some my projects later.
Each time I manually stop and restart n8n via docker, I am loosing all my config. This is n8n Community Edition.
I need to register my account every time and all my workflows and credentials are lost, I have to apply my license key again.
I am using local on-prem n8n installation via docker on Ubuntu 24.04.
My docker-compose.yml file seems to be correct.
When I restart whole Ubuntu machine, the config and all data is persistent after reboot. Data is cleared only when services are manually stopped and started.
Any hints, guys?
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
What this sounds like to me is a persistence issue rather than n8n clearing data on its own.
In Docker, n8n stores the default SQLite database file and encryption key under /home/node/.n8n, so if that folder isnât mounted to a persistent volume, or if the container is being recreated against a different/empty mount when you manually stop and start it, youâll see exactly this kind of âfresh installâ behavior with lost users, workflows, credentials, and license data. Iâd first check whether your compose file really mounts /home/node/.n8n persistently, and also whether youâre using docker compose stop/start versus something that recreates the container or points it at a different working directory or volume.
Youâre probably using docker compose down which removes containers and anonymous volumes. Use docker compose stop and docker compose start instead. Also make sure your docker-compose.yml uses a named volume for /home/node/.n8n, not an anonymous one.
yeah docker compose down wipes the volumes if theyâre anonymous â stop/start is the right move. one gotcha weâve run into: the encryption key can get out of sync between container runs if youâre not setting DB_ENCRYPTION_KEY consistently in your env vars. make sure thatâs pinned on restart or youâll hit decryption errors later.
hey @Robert5 â the named volume setup looks correct, you donât need to create /home/node manually on the host â Docker manages that entirely, permissions included.
two things worth fixing in your compose file though:
thereâs a typo in the timezone: Europe/Xwarsaw should be Europe/Warsaw
env var values in docker-compose YAML shouldnât have quotes around them â so GENERIC_TIMEZONE="Europe/Warsaw" should just be GENERIC_TIMEZONE=Europe/Warsaw. with the quotes, Docker passes them as literal values including the quote characters, which can cause unexpected behavior.
with those fixed, and using docker compose stop / docker compose start instead of down, your data should persist fine.
Glad itâs all working now! Yeah, quoted env var values in docker-compose is one of those silent gotchas thatâs easy to miss. Good luck with your n8n projects!