Losing all data after restarting docker

I was using n8n via Docker and everything was good&fun until I decided to update the n8n version. I followed the doc but I think I did something wrong. Right now every time when I restart the docker or computer I’m losing all my progress like its fresh start. It’s frustrating. Could you guys help me?

Similar Question
I think I’m having the same issue with this question but didn’t understand the solution

Command Line I’m using for docker

docker run -it -d --name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n n8nio/n8n 

Uptade: I just made my friend try this issue on his computer and he is getting the same problem. So I don’t think I did something wrong.

n8n version 0.164.1 via Docker on Win10

Hey @burakyccl,

Normally that issue would indicate a problem with the storage of the database, In the command you have the volume set which is good so ~/.n8n on your machine will be used in the container as /home/node/.n8n.

I suspect what has happened is the ~/.n8n folder has not been automatically created locally which could be a permission issue. Can you check to see if ~/.n8n exists and if it does are there any files in it? It will be a hidden file, What is important is ~ is a shortcut to the current logged in users home directory so if you are logged in as burakyccl on a Linux machine it would be /home/burakyccl/.n8n but if you ran as root it would be /root/.n8n. On Windows it would be something like C:\Users\burakyccl\.n8n and Mac is /Users/burakyccl/.n8n


Thank you for your answer. Yes, it was a permission issue. I used docker-compose from desktop and it worked like a charm. Interesting part is when I first installed n8n via docker I didn’t have this problem.