Delete all data on ENV change in Docker

Hi,
i running n8n trought docker,but on every env change delete me all data(i use my postegre db), how avoid this issue?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hello @mascimax

I suppose on env change you are recreating the new container, that’s why everything got deleted.

hi, how to avoid this?

Well… do not edit the ENV’s or create a persistent storage :slight_smile:

To keep all your workflows and n8n configuration, you will need a database on the separate instance. Plus, it’s good to keep the n8n configuration on the external volume, that you can mount to the container on startup.

hi,
i use docker env for persistent storage on my database,see below:
And other issue is possible to save workflow?,im afraid now lost on env change.
image

Initializing n8n process
Error: There was an error initializing DB
Error: connect ECONNREFUSED 127.0.0.1:3306

The message says the n8n can’t reach the DB instance on port 3306. If you have a separate instance with a DB, then it should have a different IP. 127.0.0.1 means it is located within the n8n instance