Update via Docker

Describe the issue/error/question

I just updated n8n from 0.164.1 to the latest docker image.

Stopped and removed the docker. Restarted the Docker image and receive 502 Bad Gateway nginx.
My Setup:
Domain managed over reverse proxy towards raspi
n8n running with docker on raspi
worked perfectly for over a year…

used the docker command which worked before, restarted nginx and ckecked if the docker is running.
Any suggestions what else i can try?

Please share the workflow

sudo docker run -d 
--restart=always 
--name n8n 
-p 5678:5678 
-e N8N_BASIC_AUTH_ACTIVE="true" 
-e N8N_BASIC_AUTH_USER="User" 
-e N8N_BASIC_AUTH_PASSWORD="Password!" 
-e N8N_HOST="auto.domain.org" 
-e N8N_PROTOCOL="https" 
-e VUE_APP_URL_BASE_API="https://auto.domain.org/" 
-e WEBHOOK_TUNNEL_URL="https://auto.domain.org/" 
-v ~/.n8n:/home/node/.n8n n8nio/n8n

Hey @Jendrik,

Welcome to the community :tada:

502 sounds like maybe n8n isn’t running, Do you see any errors in the docker log?

1 Like

Alright that explains it…

Initializing n8n process
Migrations in progress, please do NOT stop the process.
Migration “CreateUserManagement1646992772331” failed, error: SQLITE_ERROR: table “role” already exists
There was an error initializing DB: “SQLITE_ERROR: table “role” already exists”

do you have a tipp how to solve this?
Or do I have to set the whole thing up again? If yes I’ve seen the CLI commands to export the Workflows and Credentials but will that work if the docker is not running?

Hey @Jendrik,

Did you downgrade at some point? I suspect that has put the database in a bit of an odd state. If the container isn’t running you won’t be able to connect to it to run the commands. A quick option would be to downgrade to the version that was working then use the CLI to export the workflows and from there you can then stop the instance, move the old database and let it make a new one then import the workflows and upgrade.

It could be a good time to move to Postgres or similar as well if you wanted to move away from SQLite.

I tried to downgrade to the version I was running before, but it is still not running… I guess I messed it up and got to set everything up in a new instance… :frowning:

Hey @Jendrik,

What error do you get on the older version is it the same? There is a more complicated way you can get your workflows.

If you copy your database file and open it with a sqlite tool you can run select queries to extract the data.

yes the same message…

I’ll try to extract the data… do you know if there is any documentation or description on that, which i can follow up on?

Hey @Jendrik,

Sadly no official steps on that one, I think you could get away with doing a dump on the workflow_entity and credential_entity table then having n8n make a new database and stopping the container and importing the dumped data into the new database.

The steps on this site seem to look pretty good so could be a good starting point: How To Use The SQLite Dump Command